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/07 18:42:46 UTC

[jira] Updated: (PLUTO-506) Invoking the store() method of PortletPreferences object results in NPE if no preferences declared in portlet.xml

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

Brian DeHamer updated PLUTO-506:
--------------------------------

    Attachment: patch-506.txt

The attached patch to the PreferencesValidatorRegistry class  updates the getPreferencesValidator method to ensure that the PortletPreferencesDD is non-null before invoking its getPreferencesValidator() method.

> Invoking the store() method of PortletPreferences object results in NPE if no preferences declared in portlet.xml
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: PLUTO-506
>                 URL: https://issues.apache.org/jira/browse/PLUTO-506
>             Project: Pluto
>          Issue Type: Bug
>          Components: portlet container
>    Affects Versions: 2.0.0, 2.0-refactoring
>         Environment: JDK 1.5.0_16, Tomcat 5.5.27
>            Reporter: Brian DeHamer
>             Fix For: 2.0.0, 2.0-refactoring
>
>         Attachments: patch-506.txt
>
>
> If you have not declared any preferences for a portlet in the deployment descriptor (portlet.xml) and then invoke the store() method of the PortletPreferences object, a NullPointerException is thrown with the following stack trace:
> java.lang.NullPointerException
> 	at org.apache.pluto.internal.PreferencesValidatorRegistry.getPreferencesValidator(PreferencesValidatorRegistry.java:97)
> 	at org.apache.pluto.internal.impl.PortletEntityImpl.getPreferencesValidator(PortletEntityImpl.java:167)
> 	at org.apache.pluto.internal.impl.PortletPreferencesImpl.internalStore(PortletPreferencesImpl.java:298)
> 	at org.apache.pluto.internal.impl.PortletPreferencesImpl.store(PortletPreferencesImpl.java:277) . . .
> In the getPreferencesValidator() method of the PreferencesValidatorRegistry the PortletPreferencesDD object is retrieved and its getPreferencesValidator() method is invoked without first checking to see if the PortletPreferencesDD object is null.
> As a workaround you can make sure that you always declare at least one preference in your portlet.xml file -- this will ensure that the PortletPreferencesDD object is not null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.