You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/04/16 08:28:00 UTC

(maven-resolver) branch maven-resolver-1.9.x updated: [MRESOLVER-536] Do not belly up if FS does not support setting mtime (#469)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch maven-resolver-1.9.x
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/maven-resolver-1.9.x by this push:
     new adadd42d [MRESOLVER-536] Do not belly up if FS does not support setting mtime (#469)
adadd42d is described below

commit adadd42d1642f39bafedb2ddd619b044fecb12b0
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Apr 16 10:27:55 2024 +0200

    [MRESOLVER-536] Do not belly up if FS does not support setting mtime (#469)
    
    This seems more logical step, simply use File.setLastModified
    as it does not throws, and is used all over the 1.9.x codebase.
    
    ---
    
    https://issues.apache.org/jira/browse/MRESOLVER-536
---
 .../main/java/org/eclipse/aether/transport/http/HttpTransporter.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
index 8cd00f50..86882a7f 100644
--- a/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
+++ b/maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java
@@ -31,7 +31,6 @@ import java.net.UnknownHostException;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
-import java.nio.file.attribute.FileTime;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashSet;
@@ -691,8 +690,7 @@ final class HttpTransporter extends AbstractTransporter {
                 if (lastModifiedHeader != null) {
                     Date lastModified = DateUtils.parseDate(lastModifiedHeader.getValue());
                     if (lastModified != null) {
-                        Files.setLastModifiedTime(
-                                task.getDataFile().toPath(), FileTime.fromMillis(lastModified.getTime()));
+                        task.getDataFile().setLastModified(lastModified.getTime());
                     }
                 }
             }