From 012a6447c850b2f869f4ccb86ecc6029e31a8ae9 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Wed, 4 Mar 2009 15:13:07 +0000 Subject: [PATCH] o Reused the error handling component git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750043 13f79535-47bb-0310-9956-ffa450edef68 --- .../resolver/DefaultArtifactResolver.java | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 6ee29ac06a..346b4ab84c 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -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; }