Pluto
  1. Pluto
  2. PLUTO-515

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: portlet container
    • Labels:
      None
    • Environment:
      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.

      1. patch-515.txt
        0.8 kB
        Brian DeHamer

        Activity

        Brian DeHamer created issue -
        Brian DeHamer made changes -
        Field Original Value New Value
        Attachment patch-515.txt [ 12392503 ]
        Ate Douma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Workflow jira [ 12444554 ] Default workflow, editable Closed status [ 12565094 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12565094 ] jira [ 12585892 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian DeHamer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development