Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-694

Behaviour change in FileUtils.copyDirectory() file last modified date/times preservation

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.9.0
    • Utilities
    • None

    Description

      API documentation for FileUtils.copyDirectory() says:

      Note: This method tries to preserve the files' last modified date/times using File.setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

      (bold emphasis added)

      In version 2.7 the "no indication is provided" part is true - if the last modified date/times could not changed, then the FileUtils.copyDirectory() will still succeed.

      In version 2.8.0, if the last modified date/times could not changed, then the FileUtils.copyDirectory() will throw an IOException. However, the API documentation is not updated, so the documentation and the implementation are inconsistent.

      The behaviour change in 2.8.0 can be traced to commit b99b3f9f484074454c6d67ec658a4e0e8555ffd2 (Throw an IOException if calling setLastModified() fails.).

      Please do one of the following:

      • Update the documentation to say that an IOException will be thrown.
      • Revert the implementation to the previous behaviour.

      Thanks.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            yeefan-ncs Tan Yee Fan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment