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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]