Uploaded image for project: 'Pluto'
  1. Pluto
  2. PLUTO-515

Retrieving user information request attribute results in NPE if no <user-attribute> elements defined

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • portlet container
    • 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.

      Attachments

        1. patch-515.txt
          0.8 kB
          Brian DeHamer

        Activity

          People

            Unassigned Unassigned
            bdehamer Brian DeHamer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: