git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@702188 13f79535-47bb-0310-9956-ffa450edef68master
@@ -229,6 +229,9 @@ Fixed bugs: | |||||
* <filterset> could miss multi-character begin tokens in some cases. | * <filterset> could miss multi-character begin tokens in some cases. | ||||
Bugzilla Report 45094. | Bugzilla Report 45094. | ||||
* <depend> didn't close JARs that were part of the classpath. | |||||
Bugzilla Report 45955. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -26,6 +26,7 @@ import java.util.Hashtable; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||
import java.util.zip.ZipFile; | import java.util.zip.ZipFile; | ||||
import org.apache.tools.ant.util.FileUtils; | |||||
import org.apache.tools.ant.util.depend.AbstractAnalyzer; | import org.apache.tools.ant.util.depend.AbstractAnalyzer; | ||||
/** | /** | ||||
@@ -96,9 +97,7 @@ public class AntAnalyzer extends AbstractAnalyzer { | |||||
analyzedDeps.put(dependency, dependency); | analyzedDeps.put(dependency, dependency); | ||||
} | } | ||||
} finally { | } finally { | ||||
if (inStream != null) { | |||||
inStream.close(); | |||||
} | |||||
FileUtils.close(inStream); | |||||
if (zipFile != null) { | if (zipFile != null) { | ||||
zipFile.close(); | zipFile.close(); | ||||
} | } | ||||
@@ -201,9 +201,7 @@ public class Depend extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
} finally { | } finally { | ||||
if (in != null) { | |||||
in.close(); | |||||
} | |||||
FileUtils.close(in); | |||||
} | } | ||||
return dependencyMap; | return dependencyMap; | ||||
@@ -238,9 +236,7 @@ public class Depend extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
} finally { | } finally { | ||||
if (pw != null) { | |||||
pw.close(); | |||||
} | |||||
FileUtils.close(pw); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -373,7 +369,9 @@ public class Depend extends MatchingTask { | |||||
if (checkPath != null) { | if (checkPath != null) { | ||||
// now determine which jars each class depends upon | // now determine which jars each class depends upon | ||||
classpathDependencies = new Hashtable(); | classpathDependencies = new Hashtable(); | ||||
AntClassLoader loader = getProject().createClassLoader(checkPath); | |||||
AntClassLoader loader = null; | |||||
try { | |||||
loader = getProject().createClassLoader(checkPath); | |||||
Hashtable classpathFileCache = new Hashtable(); | Hashtable classpathFileCache = new Hashtable(); | ||||
Object nullFileMarker = new Object(); | Object nullFileMarker = new Object(); | ||||
@@ -426,6 +424,11 @@ public class Depend extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} finally { | |||||
if (loader != null) { | |||||
loader.cleanup(); | |||||
} | |||||
} | |||||
} | } | ||||
// write the dependency cache to the disk | // write the dependency cache to the disk | ||||
@@ -61,6 +61,7 @@ public class Main { | |||||
<touch file="${src1}/a/B.java" /> | <touch file="${src1}/a/B.java" /> | ||||
<javac srcdir="${src1}" destdir="${output}"/> | <javac srcdir="${src1}" destdir="${output}"/> | ||||
<jar destfile="${output}/A.jar" basedir="${output}" includes="a/**"/> | <jar destfile="${output}/A.jar" basedir="${output}" includes="a/**"/> | ||||
<delete dir="${output}/a"/> | |||||
<depend srcDir="${src1}" | <depend srcDir="${src1}" | ||||
destDir="${output}" cache="${output}" | destDir="${output}" cache="${output}" | ||||