aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-consumers
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2018-04-02 00:22:19 +0200
committerMartin Stockhammer <martin_s@apache.org>2018-04-02 00:22:19 +0200
commit60bbe9dde66927177808f577eca9b5238ec7c614 (patch)
tree88bf8e970e81410ad87b6676c8059c0696e0dfb8 /archiva-modules/archiva-base/archiva-consumers
parent83df105260c3fe5c2a7f6fb90230426074cb37ae (diff)
downloadarchiva-60bbe9dde66927177808f577eca9b5238ec7c614.tar.gz
archiva-60bbe9dde66927177808f577eca9b5238ec7c614.zip
Trying to remove compiler warning
Diffstat (limited to 'archiva-modules/archiva-base/archiva-consumers')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java52
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java1
2 files changed, 50 insertions, 3 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
index f30bf6a4f..e36b394d7 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
@@ -166,7 +166,7 @@ public class CleanupReleasedSnapshotsRepositoryPurge
if ( needsMetadataUpdate )
{
- updateMetadata( path );
+ updateMetadata( artifactRef );
}
}
catch ( LayoutException e )
@@ -183,17 +183,63 @@ public class CleanupReleasedSnapshotsRepositoryPurge
}
}
- private void updateMetadata( String path )
+
+ /*
+ * TODO: Uses a deprecated API, but if we use the API with location string, it does not work as expected
+ * -> not sure what needs to be changed here.
+ */
+ @SuppressWarnings( "deprecation" )
+ private void updateMetadata( ArtifactReference artifact )
{
+ VersionedReference versionRef = new VersionedReference( );
+ versionRef.setGroupId( artifact.getGroupId( ) );
+ versionRef.setArtifactId( artifact.getArtifactId( ) );
+ versionRef.setVersion( artifact.getVersion( ) );
+
+ ProjectReference projectRef = new ProjectReference( );
+ projectRef.setGroupId( artifact.getGroupId( ) );
+ projectRef.setArtifactId( artifact.getArtifactId( ) );
try
{
- metadataTools.updateMetadata( repository, path );
+ metadataTools.updateMetadata( repository, versionRef );
+ }
+ catch ( ContentNotFoundException e )
+ {
+ // Ignore. (Just means we have no snapshot versions left to reference).
}
catch ( RepositoryMetadataException e )
{
// Ignore.
}
+ catch ( IOException e )
+ {
+ // Ignore.
+ }
+ catch ( LayoutException e )
+ {
+ // Ignore.
+ }
+ try
+ {
+ metadataTools.updateMetadata( repository, projectRef );
+ }
+ catch ( ContentNotFoundException e )
+ {
+ // Ignore. (Just means we have no snapshot versions left to reference).
+ }
+ catch ( RepositoryMetadataException e )
+ {
+ // Ignore.
+ }
+ catch ( IOException e )
+ {
+ // Ignore.
+ }
+ catch ( LayoutException e )
+ {
+ // Ignore.
+ }
}
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
index 2ee46ed5f..01f9a2919 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
@@ -171,6 +171,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest
XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/release", metadataXml );
XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
+ System.out.println(metadataXml);
XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
"//metadata/versioning/versions/version", metadataXml );
XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );