You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Brian DeHamer (JIRA)" <ji...@apache.org> on 2008/10/20 19:47:46 UTC

[jira] Updated: (PLUTO-515) Retrieving user information request attribute results in NPE if no elements defined

     [ https://issues.apache.org/jira/browse/PLUTO-515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian DeHamer updated PLUTO-515:
--------------------------------

    Attachment: patch-515.txt

The attached patch to the DefaultRequestAttributeService class updates the createUserInfoMap() method to ensure that the List returned by PortletDD.getUserAttribute() is non-null before attempting to iterate over it.

> 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
>
>         Attachments: patch-515.txt
>
>
> 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.