From 28ca0623119a788c754840b78a50b052518b2006 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 27 Oct 2009 14:39:48 +0000 Subject: [PATCH] Use URLProvider instead of URLResource git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@830209 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/helper/ProjectHelper2.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index d521c2f97..4eb007520 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -28,7 +28,7 @@ import org.apache.tools.ant.TargetGroup; import org.apache.tools.ant.Task; import org.apache.tools.ant.UnknownElement; import org.apache.tools.ant.types.Resource; -import org.apache.tools.ant.types.resources.URLResource; +import org.apache.tools.ant.types.resources.URLProvider; import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.JAXPUtils; import org.xml.sax.Attributes; @@ -94,16 +94,18 @@ public class ProjectHelper2 extends ProjectHelper { * content as something that can be turned into an Antlib task. * *

simply delegates to {@link #parseUnknownElement - * parseUnknownElement}.

+ * parseUnknownElement} if the resource provides an URL and throws + * an exceptipn otherwise.

* - * @since ant 1.8.0 + * @since Ant 1.8.0 */ public UnknownElement parseAntlibDescriptor(Project containingProject, Resource resource) { - if (!(resource instanceof URLResource)) { + URLProvider up = (URLProvider) resource.as(URLProvider.class); + if (up == null) { throw new BuildException("Unsupported resource type: " + resource); } - return parseUnknownElement(containingProject, ((URLResource)resource).getURL()); + return parseUnknownElement(containingProject, up.getURL()); } /**