FileUtils change to make 'copy/delete instead of renaming' feature configurable
-------------------------------------------------------------------------------

                 Key: CAMEL-4505
                 URL: https://issues.apache.org/jira/browse/CAMEL-4505
             Project: Camel
          Issue Type: Improvement
            Reporter: Maria Iracheta


It would be nice to make the enhancement in the FileUtils 'renameFile' method 
configurable. Not long ago the 'renameFile' method was changed to try 
copy/delete after 3 tries of renaming a File. In certain cases you would want 
the renaming to fail as a way of knowing that the File is opened or being used, 
otherwise it might cause the file to be copied and not deleted (because it is 
opened).

Apart of this enhancement request I think there is a bug in that area:

    
                if (!deleteFile(from)) {
                    LOG.warn("Renaming file from: {} to: {} failed due cannot 
delete from file: {} after copy succeeded", new Object[]{from, to, from});
                    renamed = false;
                }
                renamed = true;

Shouldn't this be :

                if (!deleteFile(from)) {
                    LOG.warn("Renaming file from: {} to: {} failed due cannot 
delete from file: {} after copy succeeded", new Object[]{from, to, from});
                    renamed = false;
                }
                else renamed = true;
           

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to