On Fri, 7 Aug 2020 at 19:29, <ggreg...@apache.org> wrote:
>
> 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

-1

We should not change the generated file date unless preserveFileDate is true.

As it is  now, the target file will be created with an OS-provided
modification time, which is then overridden by an arbitrary timestamp
some time in the future.

That seems wrong, and changes the existing behaviour.

> commit 9407c2af641e81a16f9c4339b2dcf5a314897ed9
> Author: Gary Gregory <gardgreg...@gmail.com>
> 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());
>      }
>
>      //-----------------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to