archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r588805 - in /maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model: ArchivaArtifact.java Keys.java
Date Fri, 26 Oct 2007 23:49:54 GMT
Author: joakime
Date: Fri Oct 26 16:49:53 2007
New Revision: 588805

URL: http://svn.apache.org/viewvc?rev=588805&view=rev
Log:
[MRM-560] Dependency Tree causes an Exception
Improving exception messages on bad ArchivaArtifact to include what details it does have.


Modified:
    maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
    maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java

Modified: maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java?rev=588805&r1=588804&r2=588805&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
(original)
+++ maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
Fri Oct 26 16:49:53 2007
@@ -41,22 +41,26 @@
     {
         if ( empty( groupId ) )
         {
-            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
groupId." );
+            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
groupId ["
+                + Keys.toKey( groupId, artifactId, version, classifier, type ) + "]" );
         }
 
         if ( empty( artifactId ) )
         {
-            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
artifactId." );
+            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
artifactId ["
+                + Keys.toKey( groupId, artifactId, version, classifier, type ) + "]" );
         }
 
         if ( empty( version ) )
         {
-            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
version." );
+            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
version ["
+                + Keys.toKey( groupId, artifactId, version, classifier, type ) + "]" );
         }
 
         if ( empty( type ) )
         {
-            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
type." );
+            throw new IllegalArgumentException( "Unable to create ArchivaArtifact with empty
type ["
+                + Keys.toKey( groupId, artifactId, version, classifier, type ) + "]" );
         }
 
         model = new ArchivaArtifactModel();

Modified: maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java?rev=588805&r1=588804&r2=588805&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
(original)
+++ maven/archiva/trunk/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
Fri Oct 26 16:49:53 2007
@@ -34,20 +34,25 @@
     {
         return toKey( model.getGroupId(), model.getArtifactId(), model.getVersion() );
     }
-
-    public static String toKey( ArtifactReference ref )
+    
+    public static String toKey( String groupId, String artifactId, String version, String
classifier, String type )
     {
         StringBuffer key = new StringBuffer();
 
-        key.append( ref.getGroupId() ).append( ":" );
-        key.append( ref.getArtifactId() ).append( ":" );
-        key.append( ref.getVersion() ).append( ":" );
-        key.append( StringUtils.defaultString( ref.getClassifier() ) ).append( ":" );
-        key.append( ref.getType() );
+        key.append( groupId ).append( ":" );
+        key.append( artifactId ).append( ":" );
+        key.append( version ).append( ":" );
+        key.append( StringUtils.defaultString( classifier ) ).append( ":" );
+        key.append( type );
 
         return key.toString();
     }
 
+    public static String toKey( ArtifactReference ref )
+    {
+        return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(),
ref.getType() );
+    }
+
     public static String toKey( ProjectReference ref )
     {
         StringBuffer key = new StringBuffer();
@@ -71,12 +76,6 @@
     
     public static String toKey( VersionedReference ref )
     {
-        StringBuffer key = new StringBuffer();
-
-        key.append( ref.getGroupId() ).append( ":" );
-        key.append( ref.getArtifactId() ).append( ":" );
-        key.append( ref.getVersion() );
-
-        return key.toString();
+        return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion() );
     }
 }



Mime
View raw message