ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r830209 - /ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
Date Tue, 27 Oct 2009 14:39:49 GMT
Author: bodewig
Date: Tue Oct 27 14:39:48 2009
New Revision: 830209

URL: http://svn.apache.org/viewvc?rev=830209&view=rev
Log:
Use URLProvider instead of URLResource

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java?rev=830209&r1=830208&r2=830209&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java Tue Oct 27 14:39:48
2009
@@ -28,7 +28,7 @@
 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 @@
      * content as something that can be turned into an Antlib task.
      *
      * <p>simply delegates to {@link #parseUnknownElement
-     * parseUnknownElement}.</p>
+     * parseUnknownElement} if the resource provides an URL and throws
+     * an exceptipn otherwise.</p>
      *
-     * @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());
     }
 
     /**



Mime
View raw message