Author: kevj Date: Thu May 4 18:46:00 2006 New Revision: 399913 URL: http://svn.apache.org/viewcvs?rev=399913&view=rev Log: - added closeQuietly methods to inner classes to use FileUtils.close
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java?rev=399913&r1=399912&r2=399913&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Replace.java Thu May 4 18:46:00 2006 @@ -351,6 +351,13 @@ void close() throws IOException { reader.close(); } + + /** + * Closes file but doesn't throw exception + */ + void closeQuietly() { + FileUtils.close(reader); + } } @@ -418,6 +425,13 @@ void close() throws IOException { writer.close(); } + + /** + * Closes file but doesn't throw exception + */ + void closeQuietly() { + FileUtils.close(writer); + } } /** @@ -557,13 +571,7 @@ + ") 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 @@ + 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(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]