Browse Source

add some extra savety measures.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269817 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
9ec1930ae7
1 changed files with 18 additions and 8 deletions
  1. +18
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java

+ 18
- 8
src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java View File

@@ -203,20 +203,30 @@ public class PropertyFile extends Task
if (m_propertyfile.exists())
{
log("Updating property file: "+m_propertyfile.getAbsolutePath());
FileInputStream fis = new FileInputStream(m_propertyfile);
BufferedInputStream bis = new BufferedInputStream(fis);
m_properties.load(bis);
if (fis != null) {
fis.close();
FileInputStream fis = null;
try {
fis = new FileInputStream(m_propertyfile);
BufferedInputStream bis = new BufferedInputStream(fis);
m_properties.load(bis);
} finally {
if (fis != null) {
fis.close();
}
}
}
else
{
log("Creating new property file: "+
m_propertyfile.getAbsolutePath());
FileOutputStream out = new FileOutputStream(m_propertyfile.getAbsolutePath());
out.flush();
out.close();
FileOutputStream out = null;
try {
out = new FileOutputStream(m_propertyfile.getAbsolutePath());
out.flush();
} finally {
if (out != null) {
out.close();
}
}
}
}
catch(IOException ioe)


Loading…
Cancel
Save