[MNG-4349] [regression] Maven hangs in endless loop if POM of relocated artifact is invalid

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@812993 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-09-09 15:26:04 +00:00
parent 2c2c13aefb
commit 22ef9f58fe
1 changed files with 7 additions and 5 deletions

View File

@ -162,6 +162,8 @@ public class MavenMetadataSource
pomArtifact = rel.pomArtifact; pomArtifact = rel.pomArtifact;
relocatedArtifact = rel.relocatedArtifact;
if ( rel.project == null ) if ( rel.project == null )
{ {
// When this happens we have a Maven 1.x POM, or some invalid POM. There is still a pile of // When this happens we have a Maven 1.x POM, or some invalid POM. There is still a pile of
@ -171,8 +173,6 @@ public class MavenMetadataSource
} }
else else
{ {
relocatedArtifact = rel.relocatedArtifact;
dependencies = rel.project.getDependencies(); dependencies = rel.project.getDependencies();
DependencyManagement depMngt = rel.project.getDependencyManagement(); DependencyManagement depMngt = rel.project.getDependencyManagement();
@ -454,13 +454,15 @@ public class MavenMetadataSource
private ProjectRelocation retrieveRelocatedProject( Artifact artifact, RepositoryRequest repositoryRequest ) private ProjectRelocation retrieveRelocatedProject( Artifact artifact, RepositoryRequest repositoryRequest )
throws ArtifactMetadataRetrievalException throws ArtifactMetadataRetrievalException
{ {
MavenProject project = null; MavenProject project;
Artifact pomArtifact; Artifact pomArtifact;
Artifact relocatedArtifact = artifact; Artifact relocatedArtifact = artifact;
boolean done = false; boolean done = false;
do do
{ {
project = null;
pomArtifact = pomArtifact =
repositorySystem.createProjectArtifact( relocatedArtifact.getGroupId(), repositorySystem.createProjectArtifact( relocatedArtifact.getGroupId(),
relocatedArtifact.getArtifactId(), relocatedArtifact.getArtifactId(),
@ -497,11 +499,11 @@ public class MavenMetadataSource
// missing/incompatible POM (e.g. a Maven 1 POM) // missing/incompatible POM (e.g. a Maven 1 POM)
if ( e.getCause() instanceof ArtifactResolutionException ) if ( e.getCause() instanceof ArtifactResolutionException )
{ {
message = "Missing artifact metadata for " + artifact.getId(); message = "Missing artifact metadata for " + relocatedArtifact.getId();
} }
else else
{ {
message = "Invalid artifact metadata for " + artifact.getId(); message = "Invalid artifact metadata for " + relocatedArtifact.getId();
} }
if ( logger.isDebugEnabled() ) if ( logger.isDebugEnabled() )