commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject svn commit: r325861 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Date Mon, 17 Oct 2005 08:55:09 GMT
Author: skitching
Date: Mon Oct 17 01:54:58 2005
New Revision: 325861

URL: http://svn.apache.org/viewcvs?rev=325861&view=rev
Log:
Avoid using InputSource(URL) constructor, as it is reported to cause jar files
to be locked on windows systems. Thanks to Rich Feit for report and patch.
See bugzilla #37034.

Modified:
    jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java

Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java?rev=325861&r1=325860&r2=325861&view=diff
==============================================================================
--- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
(original)
+++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/Digester.java
Mon Oct 17 01:54:58 2005
@@ -24,6 +24,8 @@
 import java.io.InputStream;
 import java.io.Reader;
 import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLConnection;
 import java.util.EmptyStackException;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -1515,7 +1517,21 @@
         }  
         
         try {
-            return (new InputSource(entityURL));
+            // Ideally we would just call
+            //   return (new InputSource(entityURL));
+            // Unforunately it appears that when the entityURL
+            // points to a file within a jar archive a caching mechanism
+            // inside the InputSource implementation causes a file-handle
+            // to the jar file to remain open. On Windows systems this then
+            // causes the jar archive file to be locked on disk ("in use")
+            // which makes it impossible to delete the jar file - and that
+            // really stuffs up "undeploy" in webapps in particular.
+            URLConnection urlConnection = new URL(entityURL).openConnection();
+            urlConnection.setUseCaches(false);
+            InputSource source = new InputSource(urlConnection.getInputStream());
+            source.setSystemId(entityURL);
+            return source;
+
         } catch (Exception e) {
             throw createSAXException(e);
         }



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


Mime
View raw message