Nick created IO-411:
-----------------------

             Summary: moveFile throws Exception prematurely?
                 Key: IO-411
                 URL: https://issues.apache.org/jira/browse/IO-411
             Project: Commons IO
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 2.4
            Reporter: Nick
            Priority: Minor


This may not be an issue, but I noticed that the moveFile command throws an 
exception after trying and ignoring the return value of deleteQuietly. Look at 
line 2969 below.

Taken from SVN head:
{code}
2965         final boolean rename = srcFile.renameTo(destFile);
2966            if (!rename) {
2967                copyFile( srcFile, destFile );
2968                if (!srcFile.delete()) {
2969                    FileUtils.deleteQuietly(destFile);
2970                    throw new IOException("Failed to delete original file 
'" srcFile + "' after copy to '" + destFile + "'");
2972                }
2973            }
{code}

deleteQuietly will just end up trying File.delete() again which will likely 
fail at that point, but still, shouldn't there be another if statement there?

Note: Haven't actually had issues with this.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to