mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
daeb71afc0
commit
8a6a292a68
|
@ -120,40 +120,45 @@ public abstract class AbstractRepositoryPurge
|
||||||
Collection<ArtifactMetadata> artifacts =
|
Collection<ArtifactMetadata> artifacts =
|
||||||
metadataRepository.getArtifacts( repository.getId(), reference.getGroupId(),
|
metadataRepository.getArtifacts( repository.getId(), reference.getGroupId(),
|
||||||
reference.getArtifactId(), baseVersion );
|
reference.getArtifactId(), baseVersion );
|
||||||
// cleanup snapshots metadata
|
if ( artifacts != null )
|
||||||
for ( ArtifactMetadata artifactMetadata : artifacts )
|
|
||||||
{
|
{
|
||||||
|
// cleanup snapshots metadata
|
||||||
// TODO: mismatch between artifact (snapshot) version and project (base) version here
|
for ( ArtifactMetadata artifactMetadata : artifacts )
|
||||||
if ( artifactMetadata.getVersion().equals( reference.getVersion() ) )
|
|
||||||
{
|
{
|
||||||
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 );
|
|
||||||
|
|
||||||
if ( StringUtils.equals( reference.getClassifier(),
|
|
||||||
mavenArtifactFacet.getClassifier() ) )
|
|
||||||
{
|
{
|
||||||
artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );
|
|
||||||
String groupId = reference.getGroupId(), artifactId = reference.getArtifactId(),
|
// cleanup facet which contains classifier information
|
||||||
version = reference.getVersion();
|
MavenArtifactFacet mavenArtifactFacet =
|
||||||
MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
|
(MavenArtifactFacet) artifactMetadata.getFacet(
|
||||||
mavenArtifactFacetToCompare.setClassifier( reference.getClassifier() );
|
MavenArtifactFacet.FACET_ID );
|
||||||
metadataRepository.removeArtifact( repository.getId(), groupId, artifactId,
|
|
||||||
version, mavenArtifactFacetToCompare );
|
if ( StringUtils.equals( reference.getClassifier(),
|
||||||
metadataRepository.save();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
metadataRepository.removeArtifact( artifactMetadata, VersionUtil.getBaseVersion(
|
||||||
|
reference.getVersion() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
metadataRepository.removeArtifact( artifactMetadata, VersionUtil.getBaseVersion(
|
|
||||||
reference.getVersion() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue