Jetspeed 2
  1. Jetspeed 2
  2. JS2-254

NullPointerException in PortletSession.getPortletContext()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-dev/cvs
    • Fix Version/s: None
    • Component/s: Container
    • Labels:
      None
    • Environment:
      WindowsXP SP2, JBoss 4.0.1SP1, HSQL

      Description

      From a JSR168 portlet's render method, calling:
      request.getPortletSession().getPortletContext();

      generates the following exception:
      java.lang.NullPointerException
      at org.apache.pluto.core.impl.PortletSessionImpl.getInternalPortletContext(PortletSessionImpl.java:242)
      at org.apache.pluto.core.impl.PortletSessionImpl.getPortletContext(PortletSessionImpl.java:199)
      ... portlet code ...
      at javax.portlet.GenericPortlet.render(GenericPortlet.java:175)
      at org.apache.jetspeed.factory.JetspeedPortletInstance.render(JetspeedPortletInstance.java:96)
      at org.apache.jetspeed.container.JetspeedContainerServlet.doGet(JetspeedContainerServlet.java:224)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

      This was confirmed by Ate Douma on the jetspeed-users list. His explanation is:
      ...[I] already have traced down the cause.

      The bad news:
      This isn't something new but a missing implementation of a Pluto object model interface, namely:
      PortletEntity.getPortletApplicationEntity() (which returns null in Jetspeed).

      After scanning the Pluto container sources, this is the only place this method is invoked at all (in the container that is) and we must have simply overlooked it.
      What Pluto actually does (in PortletSessionImpl.getInternalPortletContext) is trying to get to the current PortletApplicationDefinition:
      portletEntity.getPortletApplicationEntity().getPortletApplicationDefinition()
      This could just as well have been written as:
      portletEntity.getPortletDefinition().getPortletApplicationDefinition()
      which is implemented in Jetspeed.

        Activity

          People

          • Assignee:
            David Sean Taylor
            Reporter:
            David Pankros
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development