You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/06/03 21:32:53 UTC
svn commit: r1489119 -
/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
Author: sebb
Date: Mon Jun 3 19:32:53 2013
New Revision: 1489119
URL: http://svn.apache.org/r1489119
Log:
Document possible exception when file is truncated during copying
Modified:
commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
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=1489119&r1=1489118&r2=1489119&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 Mon Jun 3 19:32:53 2013
@@ -1123,13 +1123,16 @@ public class FileUtils {
* Internal copy file method.
* This caches the original file length, and throws an IOException
* if the output file length is different from the current input file length.
- * So it may fail if the file changes size.
+ * So it may fail if the file changes size.
+ * It may also fail with "IllegalArgumentException: Negative size" if the input file is truncated part way
+ * through copying the data and the new file size is less than the current position.
*
* @param srcFile the validated source file, must not be {@code null}
* @param destFile the validated destination file, must not be {@code null}
* @param preserveFileDate whether to preserve the file date
* @throws IOException if an error occurs
* @throws IOException if the output file length is not the same as the input file length after the copy completes
+ * @throws IllegalArgumentException "Negative size" if the file is truncated so that the size is less than the position
*/
private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {