This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 9407c2a Since the default behavior of file copying of attributes is
OS dependent, we give the new target file the current timestamp when
preserveFileDate is false.
9407c2a is described below
commit 9407c2af641e81a16f9c4339b2dcf5a314897ed9
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Aug 7 14:29:05 2020 -0400
Since the default behavior of file copying of attributes is OS
dependent, we give the new target file the current timestamp when
preserveFileDate is false.
---
src/main/java/org/apache/commons/io/FileUtils.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/FileUtils.java
b/src/main/java/org/apache/commons/io/FileUtils.java
index 7bee5bf..61b1541 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -1387,7 +1387,7 @@ public class FileUtils {
* position
*/
private static boolean doCopyFile(final File srcFile, final File destFile,
final boolean preserveFileDate, CopyOption... copyOptions)
- throws IOException {
+ throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but
is a directory");
}
@@ -1401,10 +1401,7 @@ public class FileUtils {
// TODO IO-386: Do we still need this check?
checkEqualSizes(srcFile, destFile, srcFile.length(),
destFile.length());
- if (preserveFileDate) {
- return destFile.setLastModified(srcFile.lastModified());
- }
- return true;
+ return destFile.setLastModified(preserveFileDate ?
srcFile.lastModified() : System.currentTimeMillis());
}
//-----------------------------------------------------------------------