ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r429237 - /ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
Date Mon, 07 Aug 2006 04:18:50 GMT
Author: bodewig
Date: Sun Aug  6 21:18:46 2006
New Revision: 429237

URL: http://svn.apache.org/viewvc?rev=429237&view=rev
Log:
make sure streams are closed, PR 40197, Submitted by Dave Brosius

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java?rev=429237&r1=429236&r2=429237&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java Sun Aug  6 21:18:46
2006
@@ -22,8 +22,9 @@
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Properties;
-import org.apache.tools.ant.types.Parameter;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Replaces tokens in the original input with user-supplied values.
@@ -227,12 +228,17 @@
      * @param fileName The file to load properties from.
      */
     private Properties getPropertiesFromFile (String fileName) {
+        FileInputStream in = null;
         Properties props = new Properties();
         try {
-            props.load(new FileInputStream(fileName));
+            in = new FileInputStream(fileName);
+            props.load(in);
         } catch (IOException ioe) {
             ioe.printStackTrace();
+        } finally {
+            FileUtils.close(in);
         }
+        
         return props;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message