[
https://issues.apache.org/jira/browse/IO-721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17331765#comment-17331765
]
Dirk Heinrichs commented on IO-721:
-----------------------------------
Yes, that should work.
BTW: I mentioned that new method already, see above. Please note that the
exception message is wrong, that line should actually be
{code:java}
throw new IOException("Failed setLastModified on " + targetFile);{code}
Because it's NOT "sourceFile" whose last modified time it tries to change.
> FileUtils.copyDirectory() tries to set last modified on source dir after
> update to 2.8.0
> ----------------------------------------------------------------------------------------
>
> Key: IO-721
> URL: https://issues.apache.org/jira/browse/IO-721
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.8.0
> Environment: Ubuntu 20.04 LTS
> Groovy 3.0.x
> Java 11 (from Ubuntu packages)
> Reporter: Dirk Heinrichs
> Priority: Major
>
> A simple
> {code:java}
> FileUtils.copyDirectory(source, dest, glob) {code}
> works fine when using Commons-IO 2.7, but fails with
> {code:java}
> Caught: java.io.IOException: Failed setLastModified on /path/to/source
> java.io.IOException: Failed setLastModified on /path/to/source
> at
> org.apache.commons.io.FileUtils.setLastModified(FileUtils.java:2561)
> at
> org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1361)
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:733)
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:659)
> at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:606)
> {code}
> after update to 2.8.0. From reading the documentation, it's also my
> understanding that "setLastModified()" should be executed on "dest" to set
> the same modification time as "source", but *not* on "source".
--
This message was sent by Atlassian Jira
(v8.3.4#803005)