Author: bodewig
Date: Wed Sep 16 04:11:21 2009
New Revision: 815599
URL: http://svn.apache.org/viewvc?rev=815599&view=rev
Log:
Close all input streams when unzipping, Submitted by David Schlosnagle, PR 42696
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=815599&r1=815598&r2=815599&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Wed Sep
16 04:11:21 2009
@@ -173,9 +173,15 @@
while (e.hasMoreElements()) {
empty = false;
ZipEntry ze = (ZipEntry) e.nextElement();
- extractFile(fileUtils, srcF, dir, zf.getInputStream(ze),
- ze.getName(), new Date(ze.getTime()),
- ze.isDirectory(), mapper);
+ InputStream is = null;
+ try {
+ extractFile(fileUtils, srcF, dir,
+ is = zf.getInputStream(ze),
+ ze.getName(), new Date(ze.getTime()),
+ ze.isDirectory(), mapper);
+ } finally {
+ FileUtils.close(is);
+ }
}
if (empty && getFailOnEmptyArchive()) {
throw new BuildException("archive '" + srcF + "' is empty");