Revision: 827
http://stripes.svn.sourceforge.net/stripes/?rev=827&view=rev
Author: bengunter
Date: 2008-02-04 09:06:15 -0800 (Mon, 04 Feb 2008)
Log Message:
-----------
Fixed STS-500: Warn when a single interceptor is configured to run more than
once
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java
2008-02-01 22:36:55 UTC (rev 826)
+++ trunk/stripes/src/net/sourceforge/stripes/config/DefaultConfiguration.java
2008-02-04 17:06:15 UTC (rev 827)
@@ -17,8 +17,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
+import java.util.Set;
import javax.servlet.ServletContext;
@@ -194,6 +196,25 @@
if (map != null) {
mergeInterceptorMaps(this.interceptors, map);
}
+
+ // do a quick check to see if any interceptor classes are
configured more than once
+ for (Map.Entry<LifecycleStage, Collection<Interceptor>> entry :
this.interceptors.entrySet()) {
+ Set<Class<? extends Interceptor>> classes = new
HashSet<Class<? extends Interceptor>>();
+ Collection<Interceptor> interceptors = entry.getValue();
+ if (interceptors == null)
+ continue;
+
+ for (Interceptor interceptor : interceptors) {
+ Class<? extends Interceptor> clazz =
interceptor.getClass();
+ if (classes.contains(clazz)) {
+ log.warn("Interceptor ", clazz,
+ " is configured to run more than once for ",
entry.getKey());
+ }
+ else {
+ classes.add(clazz);
+ }
+ }
+ }
}
catch (Exception e) {
throw new StripesRuntimeException
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