ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r718211 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java
Date Mon, 17 Nov 2008 09:41:25 GMT
Author: bodewig
Date: Mon Nov 17 01:41:24 2008
New Revision: 718211

URL: http://svn.apache.org/viewvc?rev=718211&view=rev
Log:
use adapter for FileProvider instead of instanceof in MappedResource

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java?rev=718211&r1=718210&r2=718211&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java Mon Nov
17 01:41:24 2008
@@ -175,7 +175,7 @@
     }
 
     public static MappedResource map(Resource r) {
-        return r instanceof FileProvider
+        return r.as(FileProvider.class) != null
             ? new FileProviderMR(r) : new MappedResource(r);
     }
 
@@ -185,12 +185,12 @@
 
         protected FileProviderMR(Resource r) {
             super(r);
-            if (!(r instanceof FileProvider)) {
+            p = (FileProvider) r.as(FileProvider.class);
+            if (p == null) {
                 throw new IllegalArgumentException("trying to wrap something "
-                                                   + "that is not a "
+                                                   + "that is not adaptable to "
                                                    + " FileProvider");
             }
-            p = (FileProvider) r;
         }
 
         /**



Mime
View raw message