Ensure a web application is taken out of service if the web.xml file is not valid.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 26 Feb 2011 20:01:10 +0000 (20:01 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 26 Feb 2011 20:01:10 +0000 (20:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1074914 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ContextConfig.java
webapps/docs/changelog.xml

index 3170279..6e42c45 100644 (file)
@@ -1222,7 +1222,9 @@ public class ContextConfig
                 orderedFragments = WebXml.orderWebFragments(webXml, fragments);
     
                 // Step 3. Look for ServletContainerInitializer implementations
-                ok = processServletContainerInitializers(orderedFragments);
+                if (ok) {
+                    processServletContainerInitializers(orderedFragments);
+                }
     
                 // Step 4. Process /WEB-INF/classes for annotations
                 // This will add any matching classes to the typeInitializerMap
@@ -1274,7 +1276,6 @@ public class ContextConfig
                 }
             } else {
                 webXml.configureContext(context);
-                ok = true;
             }
             
             // Always need to look for static resources
@@ -1362,7 +1363,7 @@ public class ContextConfig
      * Scan JARs for ServletContainerInitializer implementations.
      * Implementations will be added in web-fragment.xml priority order.
      */
-    protected boolean processServletContainerInitializers(
+    protected void processServletContainerInitializers(
             Set<WebXml> fragments) {
         
         for (WebXml fragment : fragments) {
@@ -1393,7 +1394,8 @@ public class ContextConfig
                 log.error(sm.getString(
                         "contextConfig.servletContainerInitializerFail", url,
                         context.getName()));
-                return false;
+                ok = false;
+                return;
             } finally {
                 if (is != null) {
                     try {
@@ -1435,7 +1437,6 @@ public class ContextConfig
             }
 
         }
-        return true;
     }
     
     
index 2154d6e..f4430f9 100644 (file)
         embedded Tomcat instance that includes at least one Context is destroyed
         without ever being started. (markt)
       </fix>
+      <fix>
+        Ensure a web application is taken out of service if the web.xml file is
+        not valid. (kkolinko/markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">