You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Nick (JIRA)" <ji...@apache.org> on 2013/11/25 22:18:36 UTC

[jira] [Created] (IO-411) moveFile throws Exception prematurely?

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)