aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins
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/plugins
parentcda4ac8085f840060ced0163d21f1e34407411d8 (diff)
downloadarchiva-f10055958657b1ebf47e664d8d240afe2b200f0f.tar.gz
archiva-f10055958657b1ebf47e664d8d240afe2b200f0f.zip
Changing time type for modification time
Diffstat (limited to 'archiva-modules/plugins')
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java9
-rw-r--r--archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java2
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java3
3 files changed, 7 insertions, 7 deletions
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
index 2b84b0d34..aefa51dd6 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
@@ -70,6 +70,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Instant;
+import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
@@ -1337,7 +1338,7 @@ public class CassandraMetadataRepository
{
// updater
ColumnFamilyUpdater<String, String> updater = this.artifactMetadataTemplate.createUpdater( key );
- updater.setLong( FILE_LAST_MODIFIED.toString(), artifactMeta.getFileLastModified().getTime() );
+ updater.setLong( FILE_LAST_MODIFIED.toString(), artifactMeta.getFileLastModified().toInstant().toEpochMilli());
updater.setLong( WHEN_GATHERED.toString(), artifactMeta.getWhenGathered().toInstant().toEpochMilli() );
updater.setLong( SIZE.toString(), artifactMeta.getSize() );
addUpdateStringValue( updater, MD5.toString(), artifactMeta.getMd5() );
@@ -1356,7 +1357,7 @@ public class CassandraMetadataRepository
.addInsertion( key, cf, column( PROJECT.toString(), artifactMeta.getProject() ) ) //
.addInsertion( key, cf, column( PROJECT_VERSION.toString(), projectVersion ) ) //
.addInsertion( key, cf, column( VERSION.toString(), artifactMeta.getVersion() ) ) //
- .addInsertion( key, cf, column( FILE_LAST_MODIFIED.toString(), artifactMeta.getFileLastModified().getTime() ) ) //
+ .addInsertion( key, cf, column( FILE_LAST_MODIFIED.toString(), artifactMeta.getFileLastModified().toInstant().toEpochMilli() ) ) //
.addInsertion( key, cf, column( SIZE.toString(), artifactMeta.getSize() ) ) //
.addInsertion( key, cf, column( MD5.toString(), artifactMeta.getMd5() ) ) //
.addInsertion( key, cf, column( SHA1.toString(), artifactMeta.getSha1() ) ) //
@@ -1407,8 +1408,8 @@ public class CassandraMetadataRepository
artifactMetadataModel.setProjectVersion( projectVersion );
artifactMetadataModel.setVersion( artifactMeta.getVersion() );
artifactMetadataModel.setFileLastModified( artifactMeta.getFileLastModified() == null
- ? new Date().getTime()
- : artifactMeta.getFileLastModified().getTime() );
+ ? ZonedDateTime.now().toInstant().toEpochMilli()
+ : artifactMeta.getFileLastModified().toInstant().toEpochMilli() );
// now facets
updateFacets( artifactMeta, artifactMetadataModel );
diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
index 48b0dfeee..da7007e9c 100644
--- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
@@ -951,7 +951,7 @@ public class FileMetadataRepository
String id = artifact.getId();
properties.setProperty( "artifact:updated:" + id,
- Long.toString( artifact.getFileLastModified().getTime() ) );
+ Long.toString( artifact.getFileLastModified().toInstant().toEpochMilli()) );
properties.setProperty( "artifact:whenGathered:" + id,
Long.toString( artifact.getWhenGathered().toInstant().toEpochMilli()) );
properties.setProperty( "artifact:size:" + id, Long.toString( artifact.getSize() ) );
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
index 7ee48d083..404762daf 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
@@ -203,8 +203,7 @@ public class JcrMetadataRepository
getOrAddArtifactNode( jcrSession, repositoryId, namespace, projectId, projectVersion, artifactMeta.getId() );
node.setProperty( "id", artifactMeta.getId( ) );
- Calendar cal = Calendar.getInstance();
- cal.setTime( artifactMeta.getFileLastModified() );
+ Calendar cal = GregorianCalendar.from(artifactMeta.getFileLastModified());
node.setProperty( JCR_LAST_MODIFIED, cal );
cal = GregorianCalendar.from(artifactMeta.getWhenGathered());