Author: sebb Date: Thu Mar 1 15:31:08 2012 New Revision: 1295618 URL: http://svn.apache.org/viewvc?rev=1295618&view=rev Log: IO-298 Various methods of class 'org.apache.commons.io.FileUtils' incorrectly suppress 'java.io.IOException'
Modified: commons/proper/io/trunk/src/changes/changes.xml commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Modified: commons/proper/io/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1295618&r1=1295617&r2=1295618&view=diff ============================================================================== --- commons/proper/io/trunk/src/changes/changes.xml (original) +++ commons/proper/io/trunk/src/changes/changes.xml Thu Mar 1 15:31:08 2012 @@ -40,6 +40,9 @@ The <action> type attribute can be add,u <body> <release version="2.2" date="TBA"> + <action dev="sebb" type="fix" issue="IO-298" due-to="Christian Schulte"> + Various methods of class 'org.apache.commons.io.FileUtils' incorrectly suppress 'java.io.IOException' + </action> <action dev="ggregory" type="add" issue="IO-304" due-to="liangly"> The second constructor of Tailer class does not pass 'delay' to the third one </action> Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1295618&r1=1295617&r2=1295618&view=diff ============================================================================== --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Thu Mar 1 15:31:08 2012 @@ -1365,6 +1365,7 @@ public class FileUtils { FileOutputStream output = openOutputStream(destination); try { IOUtils.copy(source, output); + output.close(); // don't swallow close Exception if copy completes normally } finally { IOUtils.closeQuietly(output); } @@ -1728,6 +1729,7 @@ public class FileUtils { try { out = openOutputStream(file, append); IOUtils.write(data, out, encoding); + out.close(); // don't swallow close Exception if copy completes normally } finally { IOUtils.closeQuietly(out); } @@ -1845,6 +1847,7 @@ public class FileUtils { try { out = openOutputStream(file, append); out.write(data); + out.close(); // don't swallow close Exception if copy completes normally } finally { IOUtils.closeQuietly(out); } @@ -1959,6 +1962,7 @@ public class FileUtils { try { out = openOutputStream(file, append); IOUtils.writeLines(lines, lineEnding, out, encoding); + out.close(); // don't swallow close Exception if copy completes normally } finally { IOUtils.closeQuietly(out); }