maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khmarba...@apache.org
Subject [maven-archiver] branch MSHARED-747 updated: Try to fix issue related to setLastModified
Date Sat, 28 Jul 2018 20:49:43 GMT
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MSHARED-747
in repository https://gitbox.apache.org/repos/asf/maven-archiver.git


The following commit(s) were added to refs/heads/MSHARED-747 by this push:
     new 6ade679  Try to fix issue related to setLastModified
6ade679 is described below

commit 6ade67946880100b9b111024948de40755fa338e
Author: Karl Heinz Marbaise <khmarbaise@apache.org>
AuthorDate: Sat Jul 28 22:49:26 2018 +0200

    Try to fix issue related to setLastModified
---
 .../java/org/apache/maven/archiver/MavenArchiverTest.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
index bb94b67..21ff6d2 100644
--- a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
+++ b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
@@ -236,8 +236,9 @@ public class MavenArchiverTest
         assertTrue( jarFile.exists() );
         
         long history = System.currentTimeMillis() - 60000L;
-        System.out.println( "History: " + history );
-        jarFile.setLastModified( history );
+        long historyFixed = history/1000*1000;
+        System.out.println( "historyFixed: " + historyFixed );
+        jarFile.setLastModified( historyFixed );
         long time = jarFile.lastModified();
         System.out.println( "Time:" + time );
 
@@ -250,8 +251,13 @@ public class MavenArchiverTest
         archiver.createArchive( session, project, config );
         // Is the assumption correct that the jar file itself
         // should have the same last modified time as the files itself ?
-        assertEquals( "History " + history + " time:" + time , jarFile.lastModified(), time
);
-
+   
+        // Based on some experiments with a result like this:
+        // History 1532810292406 time:1532810292000 expected:<1532810352000> but was:<1532810292000>
+        // It looks like a JDK Bug: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8177809
+        
+        assertEquals( "History " + historyFixed + " time:" + time , jarFile.lastModified(),
time );
+        
         config.setForced( true );
         archiver.createArchive( session, project, config );
         // I'm not sure if it could only be greater than time or if it is sufficient to be
greater or equal..


Mime
View raw message