Browse Source

- added closeQuietly methods to inner classes to use FileUtils.close

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@399913 13f79535-47bb-0310-9956-ffa450edef68
master
Kevin Jackson 19 years ago
parent
commit
8c1e2b5d55
1 changed files with 17 additions and 21 deletions
  1. +17
    -21
      src/main/org/apache/tools/ant/taskdefs/Replace.java

+ 17
- 21
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -351,6 +351,13 @@ public class Replace extends MatchingTask {
void close() throws IOException {
reader.close();
}
/**
* Closes file but doesn't throw exception
*/
void closeQuietly() {
FileUtils.close(reader);
}

}

@@ -418,6 +425,13 @@ public class Replace extends MatchingTask {
void close() throws IOException {
writer.close();
}
/**
* Closes file but doesn't throw exception
*/
void closeQuietly() {
FileUtils.close(writer);
}
}

/**
@@ -557,13 +571,7 @@ public class Replace extends MatchingTask {
+ ") cannot be loaded.";
throw new BuildException(message);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
}
}
FileUtils.close(in);
}

return props;
@@ -623,20 +631,8 @@ public class Replace extends MatchingTask {
+ ioe.getClass().getName() + ":"
+ ioe.getMessage(), ioe, getLocation());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// ignore
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
// ignore
}
}
in.closeQuietly();
out.closeQuietly();
if (temp != null) {
if (!temp.delete()) {
temp.deleteOnExit();


Loading…
Cancel
Save