Browse Source

properly close streams. PR 50136

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1027003 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 14 years ago
parent
commit
52504ea280
2 changed files with 10 additions and 1 deletions
  1. +4
    -0
      WHATSNEW
  2. +6
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java

+ 4
- 0
WHATSNEW View File

@@ -169,6 +169,10 @@ Fixed bugs:
* <delete> ignored <fileset>'s errorOnMissingDir attribute
Bugzilla Report 50124.

* <symlink> failed to close files when reading a list of symbolic
links from a properties file.
Bugzilla Report 50136.

Other changes:
--------------



+ 6
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -37,6 +37,7 @@ import java.io.FileOutputStream;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import java.util.Vector;
import java.util.HashSet;
@@ -560,8 +561,10 @@ public class Symlink extends DispatchTask {
File inc = new File(dir, incs[j]);
File pf = inc.getParentFile();
Properties lnks = new Properties();
InputStream is = null;
try {
lnks.load(new BufferedInputStream(new FileInputStream(inc)));
is = new BufferedInputStream(new FileInputStream(inc));
lnks.load(is);
pf = pf.getCanonicalFile();
} catch (FileNotFoundException fnfe) {
handleError("Unable to find " + incs[j] + "; skipping it.");
@@ -570,6 +573,8 @@ public class Symlink extends DispatchTask {
handleError("Unable to open " + incs[j]
+ " or its parent dir; skipping it.");
continue;
} finally {
FileUtils.close(is);
}
lnks.list(new PrintStream(
new LogOutputStream(this, Project.MSG_INFO)));


Loading…
Cancel
Save