/**
- * Any parse error which occurred while parsing XML descriptors.
- */
- protected SAXParseException parseException = null;
-
-
- /**
* Original docBase.
*/
protected String originalDocBase = null;
((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());
webDigester.parse(is);
- if (parseException != null) {
+ if (errorHandler.getParseException() != null) {
ok = false;
}
} else {
ok = false;
} finally {
webDigester.reset();
- parseException = null;
try {
stream.close();
} catch (IOException e) {
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) {
ok = false;
} finally {
digester.reset();
- parseException = null;
try {
if (stream != null) {
stream.close();
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())
ok = false;
} finally {
contextDigester.reset();
- parseException = null;
try {
if (stream != null) {
stream.close();
}
- protected class ContextErrorHandler
+ protected static class ContextErrorHandler
implements ErrorHandler {
+ private SAXParseException parseException = null;
+
public void error(SAXParseException exception) {
parseException = exception;
}
parseException = exception;
}
+ public SAXParseException getParseException() {
+ return parseException;
+ }
}