]> source.dussan.org Git - archiva.git/commitdiff
[MRM-77] improve display of dependency errors
authorBrett Porter <brett@apache.org>
Fri, 8 Sep 2006 14:53:27 +0000 (14:53 +0000)
committerBrett Porter <brett@apache.org>
Fri, 8 Sep 2006 14:53:27 +0000 (14:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@441523 13f79535-47bb-0310-9956-ffa450edef68

archiva-reports-standard/src/main/java/org/apache/maven/archiva/reporting/DependencyArtifactReportProcessor.java
archiva-reports-standard/src/test/java/org/apache/maven/archiva/reporting/DependencyArtifactReportProcessorTest.java

index ba8e1e8f09ef52658e9ec6f07174c65388e2caad..0226b91314291d5c316a2c28a7b13abccb02c956 100644 (file)
@@ -86,14 +86,14 @@ public class DependencyArtifactReportProcessor
                     {
                         String reason = MessageFormat.format(
                             "Artifact''s dependency {0} does not exist in the repository",
-                            new String[]{dependency.toString()} );
+                            new String[]{getDependencyString( dependency )} );
                         reporter.addFailure( sourceArtifact, reason );
                     }
                 }
                 catch ( InvalidVersionSpecificationException e )
                 {
                     String reason = MessageFormat.format( "Artifact''s dependency {0} contains an invalid version {1}",
-                                                          new String[]{dependency.toString(),
+                                                          new String[]{getDependencyString( dependency ),
                                                               dependency.getVersion()} );
                     reporter.addFailure( sourceArtifact, reason );
                 }
@@ -101,6 +101,20 @@ public class DependencyArtifactReportProcessor
         }
     }
 
+    static String getDependencyString( Dependency dependency )
+    {
+        String str = "(group=" + dependency.getGroupId();
+        str += ", artifact=" + dependency.getArtifactId();
+        str += ", version=" + dependency.getVersion();
+        str += ", type=" + dependency.getType();
+        if ( dependency.getClassifier() != null )
+        {
+            str += ", classifier=" + dependency.getClassifier();
+        }
+        str += ")";
+        return str;
+    }
+
     private Artifact createArtifact( Dependency dependency )
         throws InvalidVersionSpecificationException
     {
index ddc88646e8e26e0c190d178f85902b4d06f1764b..ae7edc2d182bc7972df77e1e62575d85bd68b797 100644 (file)
@@ -243,11 +243,16 @@ public class DependencyArtifactReportProcessorTest
 
     private String getDependencyVersionInvalidMessage( Dependency dependency, String version )
     {
-        return "Artifact's dependency " + dependency + " contains an invalid version " + version;
+        return "Artifact's dependency " + getDependencyString( dependency ) + " contains an invalid version " + version;
+    }
+
+    private static String getDependencyString( Dependency dependency )
+    {
+        return DependencyArtifactReportProcessor.getDependencyString( dependency );
     }
 
     private String getDependencyNotFoundMessage( Dependency dependency )
     {
-        return "Artifact's dependency " + dependency.toString() + " does not exist in the repository";
+        return "Artifact's dependency " + getDependencyString( dependency ) + " does not exist in the repository";
     }
 }