Browse Source

Close property file.

PR: 30469
Submitted by:	Juerg Wanner <juerg at pyx dot ch>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276873 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
b3b1c6dcc6
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      src/main/org/apache/tools/ant/taskdefs/Replace.java

+ 11
- 1
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -328,8 +328,10 @@ public class Replace extends MatchingTask {
public Properties getProperties(File propertyFile) throws BuildException { public Properties getProperties(File propertyFile) throws BuildException {
Properties properties = new Properties(); Properties properties = new Properties();


FileInputStream in = null;
try { try {
properties.load(new FileInputStream(propertyFile));
in = new FileInputStream(propertyFile);
properties.load(in);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
String message = "Property file (" + propertyFile.getPath() String message = "Property file (" + propertyFile.getPath()
+ ") not found."; + ") not found.";
@@ -338,6 +340,14 @@ public class Replace extends MatchingTask {
String message = "Property file (" + propertyFile.getPath() String message = "Property file (" + propertyFile.getPath()
+ ") cannot be loaded."; + ") cannot be loaded.";
throw new BuildException(message); throw new BuildException(message);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
}
}
} }


return properties; return properties;


Loading…
Cancel
Save