aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/metadata/metadata-model
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-08-21 07:33:47 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-08-21 07:33:47 +0200
commitf10055958657b1ebf47e664d8d240afe2b200f0f (patch)
tree64ed89aeda016b6a422dbf21210a93a37b24b16f /archiva-modules/metadata/metadata-model
parentcda4ac8085f840060ced0163d21f1e34407411d8 (diff)
downloadarchiva-f10055958657b1ebf47e664d8d240afe2b200f0f.tar.gz
archiva-f10055958657b1ebf47e664d8d240afe2b200f0f.zip
Changing time type for modification time
Diffstat (limited to 'archiva-modules/metadata/metadata-model')
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
index a26167c86..c129d1ed8 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java
@@ -20,7 +20,11 @@ package org.apache.archiva.metadata.model;
*/
import javax.xml.bind.annotation.XmlRootElement;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.time.ZonedDateTime;
+import java.time.temporal.TemporalAccessor;
import java.util.Date;
/**
@@ -77,7 +81,7 @@ public class ArtifactMetadata
/**
* The last modified date of the artifact file, if known.
*/
- private Date fileLastModified;
+ private ZonedDateTime fileLastModified;
/**
* The file size of the artifact, if known.
@@ -141,7 +145,7 @@ public class ArtifactMetadata
public void setFileLastModified( long fileLastModified )
{
- this.fileLastModified = new Date( fileLastModified );
+ this.fileLastModified = ZonedDateTime.ofInstant(Instant.ofEpochMilli(fileLastModified), ZoneId.of("GMT"));
}
public void setWhenGathered( ZonedDateTime whenGathered )
@@ -174,7 +178,7 @@ public class ArtifactMetadata
return sha1;
}
- public Date getFileLastModified()
+ public ZonedDateTime getFileLastModified()
{
return fileLastModified;
@@ -228,9 +232,9 @@ public class ArtifactMetadata
{
return false;
}
- // We allow some
+ // Time equality by instant that means the point in time must match, but not the time zone
if ( fileLastModified != null
- ? !fileLastModified.equals( that.fileLastModified )
+ ? !fileLastModified.toInstant().equals( that.fileLastModified.toInstant() )
: that.fileLastModified != null )
{
return false;