ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r702188 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java src/tests/antunit/taskdefs/optional/depend/depend-test.xml
Date Mon, 06 Oct 2008 16:15:08 GMT
Author: bodewig
Date: Mon Oct  6 09:15:08 2008
New Revision: 702188

URL: http://svn.apache.org/viewvc?rev=702188&view=rev
Log:
make sure <depend> closes JARs.  PR 45955.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
    ant/core/trunk/src/tests/antunit/taskdefs/optional/depend/depend-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=702188&r1=702187&r2=702188&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Oct  6 09:15:08 2008
@@ -229,6 +229,9 @@
  * <filterset> could miss multi-character begin tokens in some cases.
    Bugzilla Report 45094.
 
+ * <depend> didn't close JARs that were part of the classpath.
+   Bugzilla Report 45955.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java?rev=702188&r1=702187&r2=702188&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
Mon Oct  6 09:15:08 2008
@@ -26,6 +26,7 @@
 import java.util.Vector;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.depend.AbstractAnalyzer;
 
 /**
@@ -96,9 +97,7 @@
                             analyzedDeps.put(dependency, dependency);
                         }
                     } finally {
-                        if (inStream != null) {
-                            inStream.close();
-                        }
+                        FileUtils.close(inStream);
                         if (zipFile != null) {
                             zipFile.close();
                         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java?rev=702188&r1=702187&r2=702188&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java Mon
Oct  6 09:15:08 2008
@@ -201,9 +201,7 @@
                 }
             }
         } finally {
-            if (in != null) {
-                in.close();
-            }
+            FileUtils.close(in);
         }
 
         return dependencyMap;
@@ -238,9 +236,7 @@
                     }
                 }
             } finally {
-                if (pw != null) {
-                    pw.close();
-                }
+                FileUtils.close(pw);
             }
         }
     }
@@ -373,7 +369,9 @@
         if (checkPath != null) {
             // now determine which jars each class depends upon
             classpathDependencies = new Hashtable();
-            AntClassLoader loader = getProject().createClassLoader(checkPath);
+            AntClassLoader loader = null;
+            try {
+                loader = getProject().createClassLoader(checkPath);
 
             Hashtable classpathFileCache = new Hashtable();
             Object nullFileMarker = new Object();
@@ -426,6 +424,11 @@
                     }
                 }
             }
+            } finally {
+                if (loader != null) {
+                    loader.cleanup();
+                }
+            }
         }
 
         // write the dependency cache to the disk

Modified: ant/core/trunk/src/tests/antunit/taskdefs/optional/depend/depend-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/optional/depend/depend-test.xml?rev=702188&r1=702187&r2=702188&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/optional/depend/depend-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/optional/depend/depend-test.xml Mon Oct  6 09:15:08
2008
@@ -61,6 +61,7 @@
     <touch file="${src1}/a/B.java" />
     <javac srcdir="${src1}" destdir="${output}"/>
     <jar destfile="${output}/A.jar" basedir="${output}" includes="a/**"/>
+    <delete dir="${output}/a"/>
 
     <depend srcDir="${src1}"
             destDir="${output}" cache="${output}"



Mime
View raw message