ant workspace resolver: handle properly when the cache contains the wrong resolver name
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/2c03505d Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/2c03505d Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/2c03505d Branch: refs/heads/master Commit: 2c03505da053d07cd3f729692738912bdfc2a5b7 Parents: e1188f3 Author: Nicolas Lalevée <[email protected]> Authored: Sun Feb 8 14:51:48 2015 +0100 Committer: Nicolas Lalevée <[email protected]> Committed: Sun Feb 8 14:51:48 2015 +0100 ---------------------------------------------------------------------- src/java/org/apache/ivy/ant/AntWorkspaceResolver.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2c03505d/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java ---------------------------------------------------------------------- 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 @@ public class AntWorkspaceResolver extends DataType { 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 @@ public class AntWorkspaceResolver extends DataType { f = new File(url.getPath()); } adr.setLocalFile(f); + adr.setDownloadStatus(DownloadStatus.NO); + adr.setSize(0); Message.verbose("\t[IN WORKSPACE] " + artifacts[i]); } return dr;
