Author: carnold
Date: Sat Jun 19 20:14:03 2010
New Revision: 956284

URL: http://svn.apache.org/viewvc?rev=956284&view=rev
Log:
Bug 48588: DOMConfigurator does not close input stream when configured based on 
URL

Modified:
    logging/log4j/companions/extras/trunk/src/changes/changes.xml
    
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/extras/DOMConfigurator.java

Modified: logging/log4j/companions/extras/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/changes/changes.xml?rev=956284&r1=956283&r2=956284&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/src/changes/changes.xml (original)
+++ logging/log4j/companions/extras/trunk/src/changes/changes.xml Sat Jun 19 
20:14:03 2010
@@ -37,7 +37,8 @@
        <action action="fix" issue="49812">Improve javadoc for LogMF, LogSF, 
LogXF</action>
        <action action="fix" issue="49007">CachedDateFormatTest fails on Apache 
Harmony.</action>
        <action action="fix" issue="48953">Unused imports and variables in test 
code cause gcj compile warnings.</action>
-       <action action="add" issue="43282">Add OSGi packaging info.</action>    
   
+       <action action="add" issue="43282">Add OSGi packaging info.</action>
+       <action issue="48588" action="fix">DOMConfigurator does not close input 
stream when configured based on URL.</action>
     </release>
 
 

Modified: 
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/extras/DOMConfigurator.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/extras/DOMConfigurator.java?rev=956284&r1=956283&r2=956284&view=diff
==============================================================================
--- 
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/extras/DOMConfigurator.java
 (original)
+++ 
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/extras/DOMConfigurator.java
 Sat Jun 19 20:14:03 2010
@@ -671,9 +671,14 @@ public class DOMConfigurator implements 
   void doConfigure(final URL url, LoggerRepository repository) {
       ParseAction action = new ParseAction() {
           public Document parse(final DocumentBuilder parser) throws 
SAXException, IOException {
-              InputSource src = new InputSource(url.openStream());
-              src.setSystemId(url.toString());
-              return parser.parse(src);
+              InputStream stream = url.openStream();
+              try {
+                InputSource src = new InputSource(stream);
+                src.setSystemId(url.toString());
+                return parser.parse(src);
+              } finally {
+                stream.close();
+              }
           }
           public String toString() { 
               return "url [" + url.toString() + "]"; 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to