Browse Source

Close all input streams when unzipping, Submitted by David Schlosnagle, PR 42696

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@815599 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
a7cf25e509
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      src/main/org/apache/tools/ant/taskdefs/Expand.java

+ 9
- 3
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -173,9 +173,15 @@ public class Expand extends Task {
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");


Loading…
Cancel
Save