aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-10-26 23:49:53 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-10-26 23:49:53 +0000
commit40001e82b165e97abdaafd44537431e36a9eb93f (patch)
tree90294c9a4ded952d06969c639fd22035b65ce2ca
parent103874e80ec6b1c010bd50b4cdf3f196892d366a (diff)
downloadarchiva-40001e82b165e97abdaafd44537431e36a9eb93f.tar.gz
archiva-40001e82b165e97abdaafd44537431e36a9eb93f.zip
[MRM-560] Dependency Tree causes an Exception
Improving exception messages on bad ArchivaArtifact to include what details it does have. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@588805 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java12
-rw-r--r--archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java27
2 files changed, 21 insertions, 18 deletions
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
index 1ebed65ea..d7ce2a155 100644
--- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
+++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
@@ -41,22 +41,26 @@ public class ArchivaArtifact
{
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();
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
index b89aec6d9..7d4340fc3 100644
--- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
+++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
@@ -34,20 +34,25 @@ public class Keys
{
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 class Keys
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() );
}
}