diff options
author | Martin Stockhammer <martin_s@apache.org> | 2017-09-02 13:14:33 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2017-09-02 13:18:15 +0200 |
commit | ad9fee4399fef8fb45fa018f16ba8164b4481ae5 (patch) | |
tree | be04939951a4400d6e3c24409a7c1bf368531873 /archiva-modules/archiva-base/archiva-consumers | |
parent | 6abccf351093647c55212e5412188683ed2c9832 (diff) | |
download | archiva-ad9fee4399fef8fb45fa018f16ba8164b4481ae5.tar.gz archiva-ad9fee4399fef8fb45fa018f16ba8164b4481ae5.zip |
First part in moving to java.nio
Diffstat (limited to 'archiva-modules/archiva-base/archiva-consumers')
2 files changed, 7 insertions, 4 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java index 9b1615f76..44b7daa19 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java @@ -211,7 +211,7 @@ public abstract class AbstractRepositoryPurge log.error( "Error during metadata retrieval {}: {}", metaBaseId, e.getMessage( ) ); } } - Path artifactFile = repository.toFile( reference ).toPath( ); + Path artifactFile = repository.toFile( reference ); for ( RepositoryListener listener : listeners ) { diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurge.java index 2231ffc19..f893ca511 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/DaysOldRepositoryPurge.java @@ -31,6 +31,9 @@ import org.apache.archiva.repository.layout.LayoutException; import org.apache.commons.lang.time.DateUtils; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -112,12 +115,12 @@ public class DaysOldRepositoryPurge artifactFile.getAbsolutePath( ) ); newArtifactReference.setVersion( version ); - File newArtifactFile = repository.toFile( newArtifactReference ); + Path newArtifactFile = repository.toFile( newArtifactReference ); // Is this a generic snapshot "1.0-SNAPSHOT" ? if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion( ) ) ) { - if ( newArtifactFile.lastModified( ) < olderThanThisDate.getTimeInMillis( ) ) + if ( Files.getLastModifiedTime( newArtifactFile ).toMillis() < olderThanThisDate.getTimeInMillis( ) ) { artifactsToDelete.addAll( repository.getRelatedArtifacts( newArtifactReference ) ); } @@ -135,7 +138,7 @@ public class DaysOldRepositoryPurge } purge( artifactsToDelete ); } - catch ( ContentNotFoundException e ) + catch ( ContentNotFoundException | IOException e ) { throw new RepositoryPurgeException( e.getMessage( ), e ); } |