Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4505

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.2, 2.9.0
    • None
    • None
    • Unknown

    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[]

      {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;

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              maria.iracheta@gmail.com Maria Iracheta
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: