Author: markt
Date: Sun Jun  3 21:18:26 2012
New Revision: 1345782

URL: http://svn.apache.org/viewvc?rev=1345782&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/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1345781

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1345782&r1=1345781&r2=1345782&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
Sun Jun  3 21:18:26 2012
@@ -2383,6 +2383,7 @@ public class ContextConfig implements Li
         }
 
         boolean urlPatternsSet = false;
+        boolean servletNamesSet = false;
         boolean dispatchTypesSet = false;
         String[] urlPatterns = null;
 
@@ -2401,6 +2402,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);
                 }
@@ -2457,8 +2459,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();

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1345782&r1=1345781&r2=1345782&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Jun  3 21:18:26 2012
@@ -202,6 +202,10 @@
         Content-Type values that contain invalid parameters by ignoring the
         invalid parameters. (markt)
       </fix>
+      <fix>
+        <bug>53354</bug>: Correctly handle <code>@WebFilter</code> annotations
+        that do not include a mapping. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to