]> source.dussan.org Git - archiva.git/commitdiff
[MRM-2028] Fixing NPE on artifact removal
authorMartin Schreier <martin_s@apache.org>
Thu, 6 Jan 2022 10:35:36 +0000 (11:35 +0100)
committerMartin Schreier <martin_s@apache.org>
Thu, 6 Jan 2022 10:35:36 +0000 (11:35 +0100)
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurge.java

index d16e911ee608fe5725665e6ec7a05bcaf855e820..a0e984a2c02e302ea586dd56c28400c50510e117 100644 (file)
@@ -254,13 +254,12 @@ public abstract class AbstractRepositoryPurge
                                 if ( StringUtils.isNotBlank( reference.getClassifier( ) ) )
                                 {
                                     info.setClassifier( reference.getClassifier( ) );
-                                    metaRemovalList.put( info, artifactMetadata );
                                 }
                                 else
                                 {
-                                    // metadataRepository.removeTimestampedArtifact( artifactMetadata, baseVersion );
-                                    metaRemovalList.put( info, artifactMetadata );
+                                    info.setClassifier( "" );
                                 }
+                                metaRemovalList.put( info, artifactMetadata );
                             }
                         }
                     }
@@ -356,7 +355,7 @@ public abstract class AbstractRepositoryPurge
                 (MavenArtifactFacet) artifactMetadata.getFacet(
                     MavenArtifactFacet.FACET_ID );
 
-            if ( StringUtils.equals( artifactInfo.classifier,
+            if ( mavenArtifactFacet != null && StringUtils.equals( artifactInfo.classifier,
                 mavenArtifactFacet.getClassifier( ) ) )
             {
                 artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );