You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Tan Yee Fan (Jira)" <ji...@apache.org> on 2020/12/11 04:53:00 UTC

[jira] [Commented] (IO-694) Behaviour change in FileUtils.copyDirectory() file last modified date/times preservation

    [ https://issues.apache.org/jira/browse/IO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17247633#comment-17247633 ] 

Tan Yee Fan commented on IO-694:
--------------------------------

Thanks for the prompt response and commit.

However, the documentation fix is incomplete because there are many copyDirectory methods in FileUtils. (I noticed that you also modified one of the copyFile methods, but I didn't verify which code paths eventually attempt to modify the file timestamp(s).)

Perhaps you want to search for all instances of "no indication is provided"?

> Behaviour change in FileUtils.copyDirectory() file last modified date/times preservation
> ----------------------------------------------------------------------------------------
>
>                 Key: IO-694
>                 URL: https://issues.apache.org/jira/browse/IO-694
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.8.0
>            Reporter: Tan Yee Fan
>            Priority: Major
>             Fix For: 2.9.0
>
>
> API documentation for FileUtils.copyDirectory() says:
> {quote}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*.
> {quote}
> (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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)