Author: violetagg
Date: Fri Mar 15 13:57:19 2013
New Revision: 1456959
URL: http://svn.apache.org/r1456959
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54702
Close the stream at the end of the parse operation.
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=1456959&r1=1456958&r2=1456959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Mar 15
13:57:19 2013
@@ -1725,6 +1725,17 @@ public class ContextConfig implements Li
}
+ /**
+ * Parses the given source and stores the parsed data in the given web.xml
+ * representation. The byte stream will be closed at the end of the parse
+ * operation.
+ *
+ * @param source Input source containing the XML data to be parsed
+ * @param dest The object representation of common elements of web.xml and
+ * web-fragment.xml
+ * @param fragment Specifies whether the source is web-fragment.xml or
+ * web.xml
+ */
protected void parseWebXml(InputSource source, WebXml dest,
boolean fragment) {
@@ -1774,6 +1785,15 @@ public class ContextConfig implements Li
} finally {
digester.reset();
ruleSet.recycle();
+
+ InputStream is = source.getByteStream();
+ if (is != null) {
+ try {
+ is.close();
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ }
+ }
}
}
@@ -2517,13 +2537,6 @@ public class ContextConfig implements Li
parseWebXml(source, fragment, true);
}
} finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ioe) {
- // Ignore
- }
- }
if (jar != null) {
jar.close();
}
@@ -2563,13 +2576,6 @@ public class ContextConfig implements Li
parseWebXml(source, fragment, true);
}
} finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (Throwable t) {
- ExceptionUtils.handleThrowable(t);
- }
- }
fragment.setURL(file.toURI().toURL());
if (fragment.getName() == null) {
fragment.setName(fragment.getURL().toString());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]