Dot in context path or portlet name causes NPE in Pluto driver
--------------------------------------------------------------

                 Key: PLUTO-270
                 URL: http://issues.apache.org/jira/browse/PLUTO-270
             Project: Pluto
          Issue Type: Bug
          Components: portal driver
    Affects Versions: 1.1.0-beta2, 1.1.0-beta1, 1.1.0-alpha1
         Environment: All environments
            Reporter: Craig Doremus
         Assigned To: Craig Doremus
             Fix For: 1.1.0


When there is a dot (.) in the context path of a portet, the Pluto driver 
throws an NPE that points to a logging call in 
PortletModeAnchorTag.isPortletModeAllowed() (line 161) because the window 
parameter is null. The cause of this null parameter is because 
ResourceConfig.getPortletWindow() cannot find the portlet application because 
the call to getContextFromPortletId() returns an incorrect context.

The solution appears to be to change the indexOf() call in 
getContextFromPortletId() to lastIndexOf() (line 239). This assumes that the 
portlet name (portlet-name in portlet.xml) also does not have a dot in its 
name. The 'dot check' in the portlet name should be done at deploy time (via 
ant, maven or admin portlet). In addition the getPortletNameFromPortletId() 
method should also change the indexOf() call to lastIndexOf() on line 252.

In other words, ResourceConfig (and other places, I'm sure) assume the portlet 
Id is the context path and portlet name appended together with a dot. 

We should also do a null check prior to the logging call in 
PortletModeAnchorTag.isPortletModeAllowed().

This is my best guess as to the cause of the problem at this moment. I will try 
to apply the 'lastIndexOf'  fixes and the null check in PortletModeAnchorTag 
when I get a chance, but anyone else is welcome to do the same.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to