ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r710086 - in /ant/core/trunk/src/main/org/apache/tools/ant: Project.java taskdefs/condition/IsReference.java
Date Mon, 03 Nov 2008 15:52:36 GMT
Author: bodewig
Date: Mon Nov  3 07:52:36 2008
New Revision: 710086

URL: http://svn.apache.org/viewvc?rev=710086&view=rev
Log:
Don't use getReference in <isreference> unless really required.  PR 44822.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/Project.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?rev=710086&r1=710085&r2=710086&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Project.java Mon Nov  3 07:52:36 2008
@@ -1963,6 +1963,15 @@
     }
 
     /**
+     * Does the project know this reference?
+     *
+     * @since Ant 1.8.0
+     */
+    public boolean hasReference(String key) {
+        return references.containsKey(key);
+    }
+
+    /**
      * Look up a reference by its key (ID).
      *
      * @param key The key for the desired reference.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java?rev=710086&r1=710085&r2=710086&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java Mon Nov
 3 07:52:36 2008
@@ -62,13 +62,13 @@
                                      + "condition");
         }
 
-        Object o = getProject().getReference(ref.getRefId());
-
-        if (o == null) {
+        String key = ref.getRefId();
+        if (!getProject().hasReference(key)) {
             return false;
         } else if (type == null) {
             return true;
         } else {
+            Object o = getProject().getReference(key);
             Class typeClass =
                 (Class) getProject().getDataTypeDefinitions().get(type);
 



Mime
View raw message