Spring Integration
  1. Spring Integration
  2. INT-1721

In FileWritingMessageHandler file.renameTo(destFile) doesn't work on Windows as expected

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.4
    • Component/s: Adapters
    • Labels:
      None
    • Environment:
      Windows Vista, JDK6

      Description

      I developed a fileNameGenerator which returns always the same filename. So, you always update the same file with the FileWritingMessageHandler.
      This doesn't work that nice on Windows OS. I expect to rename the filename.file.writing file to filename.file but this doesn't work. Or it works very random.
      After some research I concluded that the renameTo method of the java.util.File class isn't allowed by windows to rename to an existing filename.

        Issue Links

          Activity

          Hide
          Minze Tolsma added a comment -

          In https://jira.springframework.org/browse/INT-569 this was already mentioned but not described...

          Show
          Minze Tolsma added a comment - In https://jira.springframework.org/browse/INT-569 this was already mentioned but not described...
          Hide
          Mark Fisher added a comment -

          Apparently this is a duplicate. We should resolve it for 2.0.4 as such with a link to the issue it duplicates.

          Show
          Mark Fisher added a comment - Apparently this is a duplicate. We should resolve it for 2.0.4 as such with a link to the issue it duplicates.
          Hide
          Oleg Zhurakousky added a comment -

          Resolving it as duplicate to INT-1742

          Show
          Oleg Zhurakousky added a comment - Resolving it as duplicate to INT-1742
          Hide
          Brad Murray added a comment -

          Its not a duplicate, and INT-1742 fix just changes the code in FTPSession, which is not at all involved when doing a local file write via the FileWritingMessageHandler.

          Can you please add overwrite = true functionality that will remove an existing file before invoking the renameTo method. (Conceptually similar solution to the FTPSession fix) This will allow coders to choose the behaviour they require.

          Show
          Brad Murray added a comment - Its not a duplicate, and INT-1742 fix just changes the code in FTPSession, which is not at all involved when doing a local file write via the FileWritingMessageHandler. Can you please add overwrite = true functionality that will remove an existing file before invoking the renameTo method. (Conceptually similar solution to the FTPSession fix) This will allow coders to choose the behaviour they require.

            People

            • Assignee:
              Oleg Zhurakousky
              Reporter:
              Minze Tolsma
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: