diff --git a/CHANGES.txt b/CHANGES.txt index d6389619..1e93726a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ - IMPROVE: import system properties as ivy variables in standalone mode - IMPROVE: string identifying a module is now clearly different from a path - IMPROVE: better error message when publish fails due to readonly destination (IVY-83) +- FIX: bad dependency ivy files now causes failure (IVY-112) - FIX: stack overflow error in contradictory conflict cases (IVY-117) - FIX: publish now doesn't call deliver when not necessary (IVY-119) - FIX: cachefileset was returning all artifacts for empty configuration (IVY-108) diff --git a/src/java/fr/jayasoft/ivy/IvyNode.java b/src/java/fr/jayasoft/ivy/IvyNode.java index afedaa10..66399ced 100644 --- a/src/java/fr/jayasoft/ivy/IvyNode.java +++ b/src/java/fr/jayasoft/ivy/IvyNode.java @@ -527,12 +527,12 @@ public class IvyNode { if (_md != null) { Configuration c = _md.getConfiguration(conf); if (c == null) { - Message.error("configuration not found in "+this+": "+conf+". It was required from "+getParent()+" "+getParentConf()); _confsToFetch.remove(conf); + _problem = new RuntimeException("configuration not found in "+this+": "+conf+". It was required from "+getParent()+" "+getParentConf()); return false; } else if (!isRoot() && c.getVisibility() != Configuration.Visibility.PUBLIC) { - Message.error("configuration not public in "+this+": "+c+". It was required from "+getParent()+" "+getParentConf()); _confsToFetch.remove(conf); + _problem = new RuntimeException("configuration not public in "+this+": "+c+". It was required from "+getParent()+" "+getParentConf()); return false; } } diff --git a/src/java/fr/jayasoft/ivy/Main.java b/src/java/fr/jayasoft/ivy/Main.java index c2d66abd..f8ca2305 100644 --- a/src/java/fr/jayasoft/ivy/Main.java +++ b/src/java/fr/jayasoft/ivy/Main.java @@ -25,6 +25,7 @@ import org.apache.commons.cli.ParseException; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.types.Path; +import fr.jayasoft.ivy.report.ResolveReport; import fr.jayasoft.ivy.url.URLHandlerDispatcher; import fr.jayasoft.ivy.url.URLHandlerRegistry; import fr.jayasoft.ivy.util.DefaultMessageImpl; @@ -232,13 +233,14 @@ public class Main { Date date = new Date(); - ModuleDescriptor md = ivy.resolve( + ResolveReport report = ivy.resolve( ivyfile.toURL(), null, confs, cache, date, - validate).getModuleDescriptor(); + validate); + ModuleDescriptor md = report.getModuleDescriptor(); if (confs.length == 1 && "*".equals(confs[0])) { confs = md.getConfigurationsNames(); diff --git a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java index 9b61b6a9..f51d18b8 100644 --- a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java +++ b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java @@ -51,7 +51,7 @@ import fr.jayasoft.ivy.util.XMLHelper; * */ public class XmlModuleDescriptorParser extends DefaultHandler { - private static final Collection ALLOWED_VERSIONS = Arrays.asList(new String[] {"1.0", "1.1", "1.2"}); + private static final Collection ALLOWED_VERSIONS = Arrays.asList(new String[] {"1.0", "1.1", "1.2", "1.3"}); private DefaultModuleDescriptor _md; private DefaultDependencyDescriptor _dd; @@ -426,7 +426,7 @@ public class XmlModuleDescriptorParser extends DefaultHandler { } public void error(SAXParseException ex) { - Message.error("xml parsing: " + + addError("xml parsing: " + getLocationString(ex)+": "+ ex.getMessage()); } diff --git a/test/java/fr/jayasoft/ivy/ant/IvyResolveTest.java b/test/java/fr/jayasoft/ivy/ant/IvyResolveTest.java index bde5c83b..826ad89d 100644 --- a/test/java/fr/jayasoft/ivy/ant/IvyResolveTest.java +++ b/test/java/fr/jayasoft/ivy/ant/IvyResolveTest.java @@ -101,6 +101,16 @@ public class IvyResolveTest extends TestCase { } } + public void testFailureOnBadDependencyIvyFile() throws Exception { + try { + _resolve.setFile(new File("test/java/fr/jayasoft/ivy/ant/ivy-failure2.xml")); + _resolve.execute(); + fail("failure didn't raised an exception with default haltonfailure setting"); + } catch (BuildException ex) { + // ok => should raised an exception + } + } + public void testHaltOnFailure() throws Exception { try { _resolve.setFile(new File("test/java/fr/jayasoft/ivy/ant/ivy-failure.xml")); diff --git a/test/java/fr/jayasoft/ivy/ant/ivy-failure2.xml b/test/java/fr/jayasoft/ivy/ant/ivy-failure2.xml new file mode 100644 index 00000000..104a35bf --- /dev/null +++ b/test/java/fr/jayasoft/ivy/ant/ivy-failure2.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/test/repositories/1/orgfailure/modfailure/ivys/ivy-1.0.xml b/test/repositories/1/orgfailure/modfailure/ivys/ivy-1.0.xml new file mode 100644 index 00000000..4faf47f4 --- /dev/null +++ b/test/repositories/1/orgfailure/modfailure/ivys/ivy-1.0.xml @@ -0,0 +1,8 @@ + + + +