ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1027003 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
Date Mon, 25 Oct 2010 09:40:29 GMT
Author: bodewig
Date: Mon Oct 25 09:40:29 2010
New Revision: 1027003

URL: http://svn.apache.org/viewvc?rev=1027003&view=rev
Log:
properly close streams.  PR 50136

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1027003&r1=1027002&r2=1027003&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Oct 25 09:40:29 2010
@@ -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:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java?rev=1027003&r1=1027002&r2=1027003&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java Mon Oct
25 09:40:29 2010
@@ -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 DispatchTas
                 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 DispatchTas
                     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)));



Mime
View raw message