Revision: 820
          http://stripes.svn.sourceforge.net/stripes/?rev=820&view=rev
Author:   bengunter
Date:     2008-01-30 21:28:16 -0800 (Wed, 30 Jan 2008)

Log Message:
-----------
Fixed STS-482 and STS-497. DelegatingExceptionHandler no longer attempts to 
instantiate abstract classes. The DelegatingExceptionHandler.Packages config 
property that was previously added for 1.5 has been removed in favor of the 
even newer Extension.Packages property supported by BootstrapPropertyResolver.

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/exception/DelegatingExceptionHandler.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/exception/DelegatingExceptionHandler.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/exception/DelegatingExceptionHandler.java
 2008-01-31 04:49:08 UTC (rev 819)
+++ 
trunk/stripes/src/net/sourceforge/stripes/exception/DelegatingExceptionHandler.java
 2008-01-31 05:28:16 UTC (rev 820)
@@ -19,8 +19,6 @@
 import net.sourceforge.stripes.config.Configuration;
 import net.sourceforge.stripes.util.Log;
 import net.sourceforge.stripes.util.ResolverUtil;
-import net.sourceforge.stripes.util.StringUtil;
-import net.sourceforge.stripes.controller.AnnotatedClassActionResolver;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -29,6 +27,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -78,12 +77,6 @@
     /** Configuration key used to lookup the package filters used when 
scanning for handlers. */
     @Deprecated public static final String PACKAGE_FILTERS = 
"DelegatingExceptionHandler.PackageFilters";
 
-    /**
-     * Configuration key used to lookup the list of packages to scan for auto 
handlers.
-     * @since Stripes 1.5
-     */
-    public static final String PACKAGES = 
"DelegatingExceptionHandler.Packages";
-
     private Configuration configuration;
 
     /** Provides subclasses with access to the configuration object. */
@@ -133,8 +126,10 @@
         // Fetch the AutoExceptionHandler implementations and add them to the 
cache
         Set<Class<? extends AutoExceptionHandler>> handlers = findClasses();
         for (Class<? extends AutoExceptionHandler> handler : handlers) {
-            log.debug("Processing class ", handler, " looking for exception 
handling methods.");
-            addHandler(handler);
+            if (!Modifier.isAbstract(handler.getModifiers())) {
+                log.debug("Processing class ", handler, " looking for 
exception handling methods.");
+                addHandler(handler);
+            }
         }
     }
 
@@ -245,31 +240,10 @@
                       "you should specify neither ", URL_FILTERS, " or ", 
PACKAGE_FILTERS,
                       ". Instead you should specify a comma separated list of 
package roots ",
                       "(e.g. com.myco.web) that should be scanned for 
implementations of ",
-                      "AutoExceptionHandler, using the configuration parameter 
'", PACKAGES,  "'.");
+                      "AutoExceptionHandler, using the configuration parameter 
'",
+                      BootstrapPropertyResolver.EXTENSION_LIST,  "'.");
         }
-
-        String packages = bootstrap.getProperty(PACKAGES);
-        if (packages == null) {
-            log.info("No configuration value was found for parameter '", 
PACKAGES,
-                     "' defaulting to using the value of '", 
AnnotatedClassActionResolver.PACKAGES,
-                     "' instead.");
-            packages = 
bootstrap.getProperty(AnnotatedClassActionResolver.PACKAGES);
-        }
-
-        if (packages == null) {
-            throw new StripesRuntimeException(
-                    "You must supply a value for the configuration parameter 
'" + PACKAGES + "', " +
-                    "or /at least/ a value for '" + 
AnnotatedClassActionResolver.PACKAGES +
-                    "' when using the DelegatingExceptionHandler. The  value 
should be a list of " +
-                    "one or more package roots (comma separated) that are to 
be scanned for " +
-                    "AutoExceptionHandler implementations. The packages 
specified and all " +
-                    "subpackages are examined for implementations of 
AutoExceptionHandler."
-            );
-        }
-
-        String[] pkgs = StringUtil.standardSplit(packages);
-        ResolverUtil<AutoExceptionHandler> resolver = new 
ResolverUtil<AutoExceptionHandler>();
-        resolver.findImplementations(AutoExceptionHandler.class, pkgs);
-        return resolver.getClasses();
+        return new HashSet<Class<? extends AutoExceptionHandler>>(
+                bootstrap.getClassPropertyList(AutoExceptionHandler.class));
     }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to