]> source.dussan.org Git - archiva.git/commitdiff
take of version when we delete a timestamped snapshot
authorOlivier Lamy <olamy@apache.org>
Fri, 22 Jun 2012 13:10:41 +0000 (13:10 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 22 Jun 2012 13:10:41 +0000 (13:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1352873 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java

index e51a360f0e744773fb063997097cee7e95bfec57..e69ce4631c3c361ff81764ac038ce17f1063f646 100644 (file)
@@ -728,9 +728,23 @@ public class DefaultRepositoriesService
 
                 updateMetadata( metadata, metadataFile, lastUpdatedTimestamp, artifact );
             }
-            Collection<ArtifactMetadata> artifacts =
-                metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
-                                                 artifact.getVersion() );
+            Collection<ArtifactMetadata> artifacts = Collections.emptyList();
+
+            if ( snapshotVersion )
+            {
+                String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() );
+                artifacts =
+                    metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
+                                                     baseVersion );
+            }
+            else
+            {
+                artifacts =
+                    metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
+                                                     artifact.getVersion() );
+            }
+
+            log.debug( "artifacts: {}", artifacts );
 
             for ( ArtifactMetadata artifactMetadata : artifacts )
             {
@@ -813,6 +827,7 @@ public class DefaultRepositoriesService
         }
         finally
         {
+
             repositorySession.save();
 
             repositorySession.close();