You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2003/10/17 07:58:03 UTC
cvs commit: maven/src/java/org/apache/maven/project Dependency.java
dion 2003/10/16 22:58:03
Modified: src/java/org/apache/maven/project Dependency.java
Log:
Fix for MAVEN-908.
If groupId and artifactId are null/empty and id is null, an IllegalStateException is thrown describing the error.
Revision Changes Path
1.42 +14 -9 maven/src/java/org/apache/maven/project/Dependency.java
Index: Dependency.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Dependency.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Dependency.java 11 Sep 2003 13:03:56 -0000 1.41
+++ Dependency.java 17 Oct 2003 05:58:03 -0000 1.42
@@ -131,10 +131,10 @@
}
/**
- *
- * @return
+ * @throws IllegalStateException if groupId, artifactId and id are all invalid
+ * @return groupId:artifactId if both are valid, or the id.
*/
- public String getId()
+ public String getId() throws IllegalStateException
{
if ( isValid( getGroupId() )
&& isValid( getArtifactId() ) )
@@ -150,6 +150,11 @@
return getGroupId() + ":" + getArtifactId();
}
+ if (id == null)
+ {
+ throw new IllegalStateException("either id or (groupId and artifactId) must be "
+ + "provided for a dependency");
+ }
return id;
}
@@ -305,10 +310,10 @@
public String getType()
{
String result = null;
-
+
if (this.type != null)
{
- result = this.type.getType();
+ result = this.type.getType();
}
return result;
}
@@ -319,14 +324,14 @@
public String getExtension()
{
String result = null;
-
+
if (this.type != null)
{
- result = this.type.getExtension();
+ result = this.type.getExtension();
}
return result;
}
-
+
/**
* Sets the dependency type such as "jar" or "war"
*
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org