You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cd...@apache.org on 2008/10/08 09:00:21 UTC
svn commit: r702737 -
/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java
Author: cdoremus
Date: Wed Oct 8 00:00:21 2008
New Revision: 702737
URL: http://svn.apache.org/viewvc?rev=702737&view=rev
Log:
Applied patch from PLUTO-506. Thank you Brian!
Modified:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java?rev=702737&r1=702736&r2=702737&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/PreferencesValidatorRegistry.java Wed Oct 8 00:00:21 2008
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
/**
* The portlet preferences validator registry. This class caches the portlet
@@ -89,29 +90,32 @@
}
// Try to construct the validator instance for the portlet definition.
- String className = portletDD.getPortletPreferences()
- .getPreferencesValidator();
- if (className != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Creating preferences validator: " + className);
- }
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try {
- Class clazz = loader.loadClass(className);
- validator = (PreferencesValidator) clazz.newInstance();
- cache.put(portletDD, validator);
- } catch (InstantiationException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (IllegalAccessException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (ClassNotFoundException ex) {
- LOG.error("Error instantiating validator.", ex);
- throw new ValidatorException(ex, null);
- } catch (ClassCastException ex) {
- LOG.error("Error casting instance to PreferencesValidator.", ex);
- throw new ValidatorException(ex, null);
+ PortletPreferencesDD portletPreferencesDD = portletDD.getPortletPreferences();
+
+ if (portletPreferencesDD != null) {
+ String className = portletPreferencesDD.getPreferencesValidator();
+ if (className != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Creating preferences validator: " + className);
+ }
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try {
+ Class clazz = loader.loadClass(className);
+ validator = (PreferencesValidator) clazz.newInstance();
+ cache.put(portletDD, validator);
+ } catch (InstantiationException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (IllegalAccessException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (ClassNotFoundException ex) {
+ LOG.error("Error instantiating validator.", ex);
+ throw new ValidatorException(ex, null);
+ } catch (ClassCastException ex) {
+ LOG.error("Error casting instance to PreferencesValidator.", ex);
+ throw new ValidatorException(ex, null);
+ }
}
}
return validator;