Author: mbenson
Date: Tue Jul 24 15:21:59 2007
New Revision: 559243

URL: http://svn.apache.org/viewvc?view=rev&rev=559243
Log:
defer call to delegateIteratorToList()
Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java?view=diff&rev=559243&r1=559242&r2=559243
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java Tue Jul 24 
15:21:59 2007
@@ -142,7 +142,7 @@
 
     }
 
-    private final boolean preserveBC = delegateIteratorToList();
+    private Boolean preserveBC;
 
     private Union union = null;
 
@@ -687,7 +687,7 @@
             return ((Path) getCheckedRef()).iterator();
         }
         dieOnCircularReference();
-        if (preserveBC) {
+        if (getPreserveBC()) {
             return new FileResourceIterator(null, list());
         }
         return union == null ? EMPTY_ITERATOR
@@ -726,8 +726,7 @@
      * The default behavior of this method is to return <code>true</code> for 
any subclass
      * that implements <code>list()</code>; this can, of course, be avoided by 
overriding
      * this method to return <code>false</code>. It is not expected that the 
result of this
-     * method should change over time; thus it is called a single time during 
instance
-     * initialization.
+     * method should change over time, thus it is called only once.
      * @return <code>true</code> if <code>iterator()</code> should delegate to 
<code>list()</code>.
      */
     protected boolean delegateIteratorToList() {
@@ -741,5 +740,12 @@
             //shouldn't happen, but
             return false;
         }
+    }
+
+    private synchronized boolean getPreserveBC() {
+        if (preserveBC == null) {
+            preserveBC = delegateIteratorToList() ? Boolean.TRUE : 
Boolean.FALSE;
+        }
+        return preserveBC.booleanValue();
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to