Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0.2
-
None
-
None
-
Jetty, Java 6 (not important)
Description
When Pluto is configured as a root webapp (with empty webapp context), portlets cannot be run properly (display NPE):
java.lang.NullPointerException
at org.apache.pluto.container.impl.PortletContainerImpl.doRender(PortletContainerImpl.java:141)
at org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:165)
at org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspx_meth_pluto_005fportlet_005f0(portlet_002dskin_jsp.java:98)
This can be fixed by not adding a double slash in PortletContextManager (line 214):
Broken:
DriverPortletConfig ipc = portletConfigs.get(applicationName + "/" + portletName);
Fixed:
DriverPortletConfig ipc = portletConfigs.get(("/".equals(applicationName) ? "" : applicationName) + "/" + portletName);
This fix is able to display portlets correctly, however problems occur when PageAdminPortlet adds a new portlet to a page:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:686)
at org.apache.pluto.driver.services.portal.PortletWindowConfig.createPortletId(PortletWindowConfig.java:112)
at org.apache.pluto.driver.services.portal.PageConfig.addPortlet(PageConfig.java:61)
Which is clearly a bug in PortletWindowConfig, line 112:
Broken:
if (contextPath.charAt(0) == '/')
Fixed:
if (contextPath.length() > 1 && contextPath.charAt(0) == '/')
After this two fixes are applied, pluto works very fine with empty web context. This problem is also described in some forums on the web, so it might be a good idea to fix it.