You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/06/30 05:36:58 UTC

svn commit: r959177 - /ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java

Author: bodewig
Date: Wed Jun 30 03:36:57 2010
New Revision: 959177

URL: http://svn.apache.org/viewvc?rev=959177&view=rev
Log:
simplify fix for PR 49373

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java?rev=959177&r1=959176&r2=959177&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java Wed Jun 30 03:36:57 2010
@@ -66,20 +66,31 @@ public class ResolvePropertyMap implemen
         }
 
         try {
+
+            // If the property we are looking up is a key in the map
+            // (first call into this method from resolveAllProperties)
+            // or we've been asked to prefix the value side (later
+            // recursive calls via the GetProperty interface) the
+            // prefix must be prepended when looking up the property
+            // outside of the map.
             String fullKey = name;
-            if (prefix != null && prefixValues) {
+            if (prefix != null && (expandingLHS || prefixValues)) {
                 fullKey = prefix + name;
             }
-            Object masterValue = expandingLHS
-                ? null : master.getProperty(fullKey);
-            // if the property is defined outside of this map don't
-            // consult the map at all.
+
+            Object masterValue = master.getProperty(fullKey);
             if (masterValue != null) {
+                // If the property already has a value outside of the
+                // map, use that value to enforce property
+                // immutability.
+
                 return masterValue;
             }
 
-            expandingLHS = false;
             seen.add(name);
+            expandingLHS = false;
+            // will recurse into this method for each property
+            // reference found in the map's value
             return parseProperties.parseProperties((String) map.get(name));
         } finally {
             seen.remove(name);
@@ -125,19 +136,7 @@ public class ResolvePropertyMap implemen
         for (Iterator i = map.keySet().iterator(); i.hasNext();) {
             expandingLHS = true;
             String key = (String) i.next();
-
-            // if the property has already been set to the name it
-            // will have in the end, then return the existing value to
-            // ensure properties remain immutable
-            String fullKey = key;
-            if (prefix != null) {
-                fullKey = prefix + key;
-            }
-            Object result = master.getProperty(fullKey);
-
-            if (result == null) {
-                result = getProperty(key);
-            }
+            Object result = getProperty(key);
             String value = result == null ? "" : result.toString();
             map.put(key, value);
         }