Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
-
JDK 1.5.0_16, Tomcat 5.5.27
Description
If you have not declared any <user-attribute> elements in the portlet deployment descriptor (portlet.xml) and then attempt to retrieve the user information Map from the PortletRequest object a NullPointerException is thrown:
java.lang.NullPointerException
at org.apache.pluto.core.DefaultRequestAttributeService.createUserInfoMap(DefaultRequestAttributeService.java:196)
at org.apache.pluto.core.DefaultRequestAttributeService.getAttribute(DefaultRequestAttributeService.java:80)
at org.apache.pluto.internal.impl.PortletRequestImpl.getAttribute(PortletRequestImpl.java:436)
In the createUserInfoMap() method of the DefaultRequestAttributeService class, the getUserAttribute() method of the PortletDD is invoked and the returned List is used in a foreach loop – however, this return value is not checked for a null value before it is used in the loop.
As a workaround you can make sure that you always declare at least one <user-attribute> element in your portlet.xml file – this will ensure that the list returned by getUserAttribute() is no null.