Author: markt
Date: Wed Dec 18 15:57:22 2013
New Revision: 1551991

URL: http://svn.apache.org/r1551991
Log:
Refactoring the starting of individual filters into a separate private method 
so it can be reused elsewhere in the class.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1551991&r1=1551990&r2=1551991&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Wed Dec 18 
15:57:22 2013
@@ -4638,19 +4638,7 @@ public class StandardContext extends Con
         synchronized (filterConfigs) {
             filterConfigs.clear();
             for (Entry<String,FilterDef> entry : filterDefs.entrySet()) {
-                String name = entry.getKey();
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug(" Starting filter '" + name + "'");
-                }
-                try {
-                    ApplicationFilterConfig filterConfig =
-                            new ApplicationFilterConfig(this, 
entry.getValue());
-                    filterConfigs.put(name, filterConfig);
-                } catch (Throwable t) {
-                    t = ExceptionUtils.unwrapInvocationTargetException(t);
-                    ExceptionUtils.handleThrowable(t);
-                    getLogger().error(sm.getString(
-                            "standardContext.filterStart", name), t);
+                if (!filterStart(entry.getKey(), entry.getValue())) {
                     ok = false;
                 }
             }
@@ -4660,6 +4648,25 @@ public class StandardContext extends Con
     }
 
 
+    private boolean filterStart(String name, FilterDef filterDef) {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug(" Starting filter '" + name + "'");
+        }
+        try {
+            ApplicationFilterConfig filterConfig =
+                    new ApplicationFilterConfig(this, filterDef);
+            filterConfigs.put(name, filterConfig);
+        } catch (Throwable t) {
+            t = ExceptionUtils.unwrapInvocationTargetException(t);
+            ExceptionUtils.handleThrowable(t);
+            getLogger().error(sm.getString(
+                    "standardContext.filterStart", name), t);
+            return false;
+        }
+        return true;
+    }
+
+
     /**
      * Finalize and release the set of filters for this Context.
      * Return <code>true</code> if all filter finalization completed



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to