ant workspace resolver: handle properly when the cache contains the wrong resolver name
diff --git a/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java b/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
index ca576b2..14fd0b1 100644
--- a/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
+++ b/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
@@ -212,9 +212,12 @@
for (int i = 0; i < artifacts.length; i++) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
dr.addArtifactReport(adr);
- adr.setDownloadStatus(DownloadStatus.NO);
- adr.setSize(0);
URL url = artifacts[i].getUrl();
+ if (url == null || !url.getProtocol().equals("file")) {
+ // this is not an artifact managed by this resolver
+ adr.setDownloadStatus(DownloadStatus.FAILED);
+ return dr;
+ }
File f;
try {
f = new File(url.toURI());
@@ -222,6 +225,8 @@
f = new File(url.getPath());
}
adr.setLocalFile(f);
+ adr.setDownloadStatus(DownloadStatus.NO);
+ adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifacts[i]);
}
return dr;