o Reused the error handling component

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750043 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-04 15:13:07 +00:00
parent 96c06c4f1b
commit 012a6447c8
1 changed files with 4 additions and 27 deletions

View File

@ -70,6 +70,9 @@ public class DefaultArtifactResolver
@Requirement
private ArtifactCollector artifactCollector;
@Requirement
private ResolutionErrorHandler resolutionErrorHandler;
// ----------------------------------------------------------------------
// Implementation
// ----------------------------------------------------------------------
@ -323,33 +326,7 @@ public class DefaultArtifactResolver
// That's right lets just let it rip right here and send a big incomprehensible blob of text at unsuspecting
// users. Bad dog!
// Metadata cannot be found
if ( result.hasMetadataResolutionExceptions() )
{
throw result.getMetadataResolutionException( 0 );
}
// Metadata cannot be retrieved
// Cyclic Dependency Error
if ( result.hasCircularDependencyExceptions() )
{
throw result.getCircularDependencyException( 0 );
}
// Version Range Violation
if ( result.hasVersionRangeViolations() )
{
throw result.getVersionRangeViolation( 0 );
}
if ( result.getMissingArtifacts().size() > 0 )
{
throw new MultipleArtifactsNotFoundException( request.getArtifact(), result.getMissingArtifacts(), request.getRemoteRepostories() );
}
resolutionErrorHandler.throwErrors( request, result );
return result;
}