Author: maartenc
Date: Tue Feb 10 20:43:51 2009
New Revision: 743096
URL: http://svn.apache.org/viewvc?rev=743096&view=rev
Log:
Improved the error message when adding an artifact to an unknown configuration
(2nd attempt).
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ArtifactId.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=743096&r1=743095&r2=743096&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Feb 10 20:43:51 2009
@@ -85,6 +85,7 @@
trunk
=====================================
+- IMPROVEMENT: enhanced error message when defining an artifact for an unknown
configuration.
- IMPROVEMENT: display the revision of the resolved module in ivy-report.xsl
(IVY-1024) (thanks to Carlton Brown)
- IMPROVEMENT: resolver attribute for buildnumber task (IVY-1019) (thanks to
Martin Eigenbrodt)
- IMPROVEMENT: add refresh parameter to post resolve tasks (IVY-1017)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java?rev=743096&r1=743095&r2=743096&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
Tue Feb 10 20:43:51 2009
@@ -337,8 +337,9 @@
*/
public void addArtifact(String conf, Artifact artifact) {
if (!configurations.containsKey(conf)) {
- throw new IllegalArgumentException("Configuration '" + conf
- + "' doesn't exist in module " + revId);
+ throw new IllegalArgumentException("Cannot add artifact '" +
artifact.getId().getArtifactId().getShortDescription()
+ + "' to configuration '" + conf + "' of module " + revId
+ + " because this configuration doesn't exist!");
}
Collection artifacts = (Collection) artifactsByConf.get(conf);
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ArtifactId.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ArtifactId.java?rev=743096&r1=743095&r2=743096&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ArtifactId.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ArtifactId.java
Tue Feb 10 20:43:51 2009
@@ -67,9 +67,13 @@
/** {...@inheritdoc} */
public String toString() {
return getModuleId()
- + "!" + getName() + "." + getExt()
- + (getType().equals(getExt()) ? "" : "(" + getType() + ")");
-}
+ + "!" + getShortDescription();
+ }
+
+ public String getShortDescription() {
+ return getName() + "." + getExt()
+ + (getType().equals(getExt()) ? "" : "(" + getType() + ")");
+ }
/**
* @return Returns the module id.