You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/02/07 18:50:13 UTC

svn commit: r619527 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/ResolveEngine.java test/java/org/apache/ivy/ant/IvyResolveTest.java

Author: xavier
Date: Thu Feb  7 09:50:09 2008
New Revision: 619527

URL: http://svn.apache.org/viewvc?rev=619527&view=rev
Log:
FIX: Resolving for muyltiple configurations when one is not in the list of available configurations does not abort the build (IVY-720)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=619527&r1=619526&r2=619527&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Feb  7 09:50:09 2008
@@ -78,6 +78,7 @@
 - IMPROVEMENT: Downgrade Ant version requirement to 1.6 to build Ivy (IVY-687)
 - IMPROVEMENT: In the ResolveReport class, add the possibility to filter the evicted module while getting the list of DownloadArtifact (IVY-704) (thanks to Nicolas Lalevée)
 
+- FIX: Resolving for muyltiple configurations when one is not in the list of available configurations does not abort the build (IVY-720)
 - FIX: Branch attribute considered as both a standard and extra attribute on module info (IVY-726)
 - FIX: Branch attribute not set on deliver when using a non default branch (IVY-724)
 - FIX: NullPointerException reported instead of error in ivy:cachepath (IVY-690)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=619527&r1=619526&r2=619527&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Thu Feb  7 09:50:09 2008
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.net.URL;
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -447,7 +448,7 @@
                 context.setResolveData(data);
             }
             IvyNode rootNode = new IvyNode(data, md);
-    
+            
             for (int i = 0; i < confs.length; i++) {
                 if (confs[i] == null) {
                     throw new NullPointerException("null conf not allowed: confs where: "
@@ -460,8 +461,15 @@
     
                 Configuration configuration = md.getConfiguration(confs[i]);
                 if (configuration == null) {
-                    Message.error("asked configuration not found in " 
-                        + md.getModuleRevisionId() + ": " + confs[i]);
+                    Collection missingConfs = new ArrayList();
+                    missingConfs.add(" '" + confs[i] + "' ");
+                    for (i++; i < confs.length; i++) {
+                        if (md.getConfiguration(confs[i]) == null) {
+                            missingConfs.add(" '" + confs[i] + "' ");
+                        }
+                    }
+                    throw new IllegalArgumentException("asked configuration(s) not found in " 
+                        + md.getModuleRevisionId() + ": " + missingConfs);
                 } else {
                     ConfigurationResolveReport confReport = null;
                     if (report != null) {

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java?rev=619527&r1=619526&r2=619527&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java Thu Feb  7 09:50:09 2008
@@ -23,7 +23,6 @@
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.TestHelper;
-import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -192,6 +191,17 @@
             fail("failure didn't raised an exception with default haltonfailure setting");
         } catch (BuildException ex) {
             // ok => should raise an exception
+        }
+    }
+
+    public void testFailureWithMissingConfigurations() throws Exception {
+        try {
+            resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+            resolve.setConf("default,unknown");
+            resolve.execute();
+            fail("missing configurations didn't raised an exception");
+        } catch (BuildException ex) {
+            assertTrue(ex.getMessage().indexOf("unknown") != -1);
         }
     }