tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1345781 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Date Sun, 03 Jun 2012 21:16:25 GMT
Author: markt
Date: Sun Jun  3 21:16:25 2012
New Revision: 1345781

URL: http://svn.apache.org/viewvc?rev=1345781&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53354
Don't add empty filter mappings to the set of mappings - they'll fail validation

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1345781&r1=1345780&r2=1345781&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Sun Jun  3 21:16:25 2012
@@ -2315,6 +2315,7 @@ public class ContextConfig implements Li
         }
 
         boolean urlPatternsSet = false;
+        boolean servletNamesSet = false;
         boolean dispatchTypesSet = false;
         String[] urlPatterns = null;
 
@@ -2333,6 +2334,7 @@ public class ContextConfig implements Li
             } else if ("servletNames".equals(name)) {
                 String[] servletNames = processAnnotationsStringArray(evp
                         .getValue());
+                servletNamesSet = servletNames.length > 0;
                 for (String servletName : servletNames) {
                     filterMap.addServletName(servletName);
                 }
@@ -2389,8 +2391,10 @@ public class ContextConfig implements Li
         }
         if (!isWebXMLfilterDef) {
             fragment.addFilter(filterDef);
-            filterMap.setFilterName(filterName);
-            fragment.addFilterMapping(filterMap);
+            if (urlPatternsSet || servletNamesSet) {
+                filterMap.setFilterName(filterName);
+                fragment.addFilterMapping(filterMap);
+            }
         }
         if (urlPatternsSet || dispatchTypesSet) {
             Set<FilterMap> fmap = fragment.getFilterMappings();



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


Mime
View raw message