FIX: bad dependency ivy files now causes failure (IVY-112)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Xavier Hanin 2006-01-03 13:51:00 +00:00
parent e26114a8fb
commit 866ec93bfd
7 changed files with 37 additions and 6 deletions

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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());
}

View File

@ -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"));

View File

@ -0,0 +1,10 @@
<ivy-module version="1.0">
<info organisation="jayasoft"
module="resolve-failure2"
revision="1.0"
status="release"
/>
<dependencies>
<dependency org="orgfailure" name="modfailure" rev="1.0"/>
</dependencies>
</ivy-module>

View File

@ -0,0 +1,8 @@
<ivy-module version="1.0">
<info organisation="orgfailure"
module="modfailure"
revision="1.0"
status="release"
/>
<badtag/>
</ivy-module>