Retrieving user information request attribute results in NPE if no
<user-attribute> elements defined
----------------------------------------------------------------------------------------------------
Key: PLUTO-515
URL: https://issues.apache.org/jira/browse/PLUTO-515
Project: Pluto
Issue Type: Bug
Components: portlet container
Affects Versions: 2.0.0
Environment: JDK 1.5.0_16, Tomcat 5.5.27
Reporter: Brian DeHamer
Fix For: 2.0.0
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.