You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2009/09/17 18:10:05 UTC

svn commit: r816254 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Author: markt
Date: Thu Sep 17 16:10:05 2009
New Revision: 816254

URL: http://svn.apache.org/viewvc?rev=816254&view=rev
Log:
Replace parseException instance field

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=816254&r1=816253&r2=816254&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Thu Sep 17 16:10:05 2009
@@ -115,12 +115,6 @@
 
 
     /**
-     * Any parse error which occurred while parsing XML descriptors.
-     */
-    protected SAXParseException parseException = null;
-
-    
-    /**
      * Original docBase.
      */
     protected String originalDocBase = null;
@@ -351,7 +345,8 @@
                         ((StandardContext) context).setReplaceWelcomeFiles(true);
                     }
                     webDigester.push(context);
-                    webDigester.setErrorHandler(new ContextErrorHandler());
+                    ContextErrorHandler errorHandler = new ContextErrorHandler();
+                    webDigester.setErrorHandler(errorHandler);
 
                     if(log.isDebugEnabled()) {
                         log.debug("Parsing application web.xml file at " + url.toExternalForm());
@@ -359,7 +354,7 @@
 
                     webDigester.parse(is);
 
-                    if (parseException != null) {
+                    if (errorHandler.getParseException() != null) {
                         ok = false;
                     }
                 } else {
@@ -376,7 +371,6 @@
                 ok = false;
             } finally {
                 webDigester.reset();
-                parseException = null;
                 try {
                     stream.close();
                 } catch (IOException e) {
@@ -688,9 +682,10 @@
                 digester.setClassLoader(this.getClass().getClassLoader());
                 digester.setUseContextClassLoader(false);
                 digester.push(context);
-                digester.setErrorHandler(new ContextErrorHandler());
+                ContextErrorHandler errorHandler = new ContextErrorHandler();
+                digester.setErrorHandler(errorHandler);
                 digester.parse(source);
-                if (parseException != null) {
+                if (errorHandler.getParseException() != null) {
                     ok = false;
                 }
             } catch (SAXParseException e) {
@@ -704,7 +699,6 @@
                 ok = false;
             } finally {
                 digester.reset();
-                parseException = null;
                 try {
                     if (stream != null) {
                         stream.close();
@@ -790,9 +784,10 @@
                 contextDigester.setUseContextClassLoader(false);
                 contextDigester.push(context.getParent());
                 contextDigester.push(context);
-                contextDigester.setErrorHandler(new ContextErrorHandler());
+                ContextErrorHandler errorHandler = new ContextErrorHandler();
+                contextDigester.setErrorHandler(errorHandler);
                 contextDigester.parse(source);
-                if (parseException != null) {
+                if (errorHandler.parseException != null) {
                     ok = false;
                 }
                 if (log.isDebugEnabled())
@@ -811,7 +806,6 @@
                 ok = false;
             } finally {
                 contextDigester.reset();
-                parseException = null;
                 try {
                     if (stream != null) {
                         stream.close();
@@ -1366,9 +1360,11 @@
     }
 
 
-    protected class ContextErrorHandler
+    protected static class ContextErrorHandler
         implements ErrorHandler {
 
+        private SAXParseException parseException = null;
+
         public void error(SAXParseException exception) {
             parseException = exception;
         }
@@ -1381,6 +1377,9 @@
             parseException = exception;
         }
 
+        public SAXParseException getParseException() {
+            return parseException;
+        }
     }
 
 



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