From 9c9762e09907cf2cb2372ea508554b9fe7ba2ab7 Mon Sep 17 00:00:00 2001 From: Martin Schreier Date: Thu, 6 Jan 2022 10:51:45 +0100 Subject: [PATCH] [MRM-2028] Fixing NPE on metadata removal --- .../core/repository/AbstractRepositoryPurge.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 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 de2d4893d..6cef0cb64 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 @@ -263,13 +263,11 @@ public abstract class AbstractRepositoryPurge if ( StringUtils.isNotBlank( reference.getClassifier( ) ) ) { info.setClassifier( reference.getClassifier( ) ); - metaRemovalList.put( info, artifactMetadata ); - } - else - { - // metadataRepository.removeArtifact( artifactMetadata, baseVersion ); - metaRemovalList.put( info, artifactMetadata ); + } else { + info.setClassifier( "" ); } + // metadataRepository.removeArtifact( artifactMetadata, baseVersion ); + metaRemovalList.put( info, artifactMetadata ); } } } @@ -349,7 +347,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 ); -- 2.39.5