Description
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[]
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;
Attachments
Issue Links
- is related to
-
CAMEL-3793 Try to copy file when rename fails
- Resolved