summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-consumers
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-19 23:16:50 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-19 23:16:50 +0000
commit8a6a292a683900cad93b9436d068e01ba93b7a31 (patch)
tree57748236be85946444b76597bf3e767525933d72 /archiva-modules/archiva-base/archiva-consumers
parentdaeb71afc0de94a0865f0f9c6c9a88cd50f33b45 (diff)
downloadarchiva-8a6a292a683900cad93b9436d068e01ba93b7a31.tar.gz
archiva-8a6a292a683900cad93b9436d068e01ba93b7a31.zip
add null check as mock can return null
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1400336 13f79535-47bb-0310-9956-ffa450edef68
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/AbstractRepositoryPurge.java55
1 files changed, 30 insertions, 25 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 a9e15444e..be844fec9 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
@@ -120,40 +120,45 @@ public abstract class AbstractRepositoryPurge
Collection<ArtifactMetadata> artifacts =
metadataRepository.getArtifacts( repository.getId(), reference.getGroupId(),
reference.getArtifactId(), baseVersion );
- // cleanup snapshots metadata
- for ( ArtifactMetadata artifactMetadata : artifacts )
+ if ( artifacts != null )
{
-
- // TODO: mismatch between artifact (snapshot) version and project (base) version here
- if ( artifactMetadata.getVersion().equals( reference.getVersion() ) )
+ // cleanup snapshots metadata
+ for ( ArtifactMetadata artifactMetadata : artifacts )
{
- if ( StringUtils.isNotBlank( reference.getClassifier() ) )
+
+ // TODO: mismatch between artifact (snapshot) version and project (base) version here
+ if ( artifactMetadata.getVersion().equals( reference.getVersion() ) )
{
+ if ( StringUtils.isNotBlank( reference.getClassifier() ) )
+ {
- // cleanup facet which contains classifier information
- MavenArtifactFacet mavenArtifactFacet =
- (MavenArtifactFacet) artifactMetadata.getFacet( MavenArtifactFacet.FACET_ID );
+ // cleanup facet which contains classifier information
+ MavenArtifactFacet mavenArtifactFacet =
+ (MavenArtifactFacet) artifactMetadata.getFacet(
+ MavenArtifactFacet.FACET_ID );
+
+ if ( StringUtils.equals( reference.getClassifier(),
+ mavenArtifactFacet.getClassifier() ) )
+ {
+ artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );
+ String groupId = reference.getGroupId(), artifactId =
+ reference.getArtifactId(),
+ version = reference.getVersion();
+ MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
+ mavenArtifactFacetToCompare.setClassifier( reference.getClassifier() );
+ metadataRepository.removeArtifact( repository.getId(), groupId, artifactId,
+ version, mavenArtifactFacetToCompare );
+ metadataRepository.save();
+ }
- if ( StringUtils.equals( reference.getClassifier(),
- mavenArtifactFacet.getClassifier() ) )
+ }
+ else
{
- artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );
- String groupId = reference.getGroupId(), artifactId = reference.getArtifactId(),
- version = reference.getVersion();
- MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
- mavenArtifactFacetToCompare.setClassifier( reference.getClassifier() );
- metadataRepository.removeArtifact( repository.getId(), groupId, artifactId,
- version, mavenArtifactFacetToCompare );
- metadataRepository.save();
+ metadataRepository.removeArtifact( artifactMetadata, VersionUtil.getBaseVersion(
+ reference.getVersion() ) );
}
}
- else
- {
- metadataRepository.removeArtifact( artifactMetadata, VersionUtil.getBaseVersion(
- reference.getVersion() ) );
- }
-
}
}
}