From 0221f23157490e962860a7acc7e1d7f9c199e328 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Tue, 31 May 2005 16:13:01 +0000 Subject: [PATCH] o improving error report so that you know what the g:a is if the version and type are null. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@179232 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/artifact/DefaultArtifact.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java index b2f6b8aea5..40107327f5 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java @@ -62,36 +62,40 @@ public class DefaultArtifact * !!! WARNING !!! Never put in the POM. It is for mojo use * only. Classifier is for specifying derived artifacts, like ejb-client. */ - public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, + public DefaultArtifact( String groupId, + String artifactId, + String version, + String scope, + String type, String classifier ) { // These should help us catch coding errors until this code gets a whole lot clearer - if ( type == null ) - { - throw new NullPointerException( "Artifact type cannot be null." ); - } - if( groupId == null ) { throw new NullPointerException( "Artifact groupId cannot be null." ); } - - this.groupId = groupId; - if( artifactId == null ) { throw new NullPointerException( "Artifact artifactId cannot be null." ); } - - this.artifactId = artifactId; - + + // From here at least we can report the g:a + + if ( type == null ) + { + throw new NullPointerException( "Artifact type cannot be null for " + groupId + ":" + artifactId ); + } if( version == null ) { - throw new NullPointerException( "Artifact version cannot be null." ); + throw new NullPointerException( "Artifact version cannot be null for " + groupId + ":" + artifactId ); } - + + this.groupId = groupId; + + this.artifactId = artifactId; + this.version = version; this.type = type;