History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UP-1647
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Christopher J. Holdorph
Reporter: Christopher J. Holdorph
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
uPortal

Portlet Preferences store() method will fail if preference is also defined in portlet.xml

Created: 28/Mar/07 07:06 PM   Updated: 03/Jul/07 04:14 PM
Component/s: Preferences, Portlet Container
Affects Version/s: 2.5.3 GA
Fix Version/s: 2.6.0 M1, 2.5.4

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
I've discovered a bug with Portlet Preferences in uPortal 2.5.3 (and possibly other versions).

Here's the scenario. I define a <portlet-preferences> section in my portlet.xml for a <preference> with a <name> of "FOO". If I then try to set that portlet preference with PortletPreferences.setValue("FOO", "value") from my Portlet.processAction(...) I see the following Exception when trying to run PortletPreferences.store() ... (shortend for brevity)

java.lang.ClassNotFoundException:
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
    at org.jasig.portal.container.om.common.PreferenceSetImpl.getPreferencesValidator(PreferenceSetImpl.java:53)
    at org.apache.pluto.core.impl.PortletPreferencesImpl.store(PortletPreferencesImpl.java:294)
    at org.test.TestPortlet.processAction(TestPortlet.java:63)

Digging a little deeper, it seems to be related to specifying a portlet preference in the portlet.xml, but NOT specifying a prefences validator, and then trying to "store". If you eliminate any one of those (take preference out of portlet.xml, do not store, or specify a validator) then you don't get the exception.



 All   Comments   Work Log   Change History      Sort Order:
Christopher J. Holdorph [28/Mar/07 07:32 PM]
uPortal's XML utilities will return an empty string for the preferences validator class if one is not specified in the portlet.xml but a preference is. Later on the PortletPreferencesImpl class will then try to create an instance of this class. This change just adds a check to make sure the result is not null AND not an empty string. An empty string is never going to be a valid classname so this check should be safe.

Andrew Petro [16/Apr/07 03:01 PM]
Reopening to edit version info. Removing affects-version of 2.6.0 M1 so that this issue will not appear on the listings of issues known to affect 2.6.0 M1.