Browse Source

simplify fix for PR 49373

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@959177 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
ce8969a8d1
1 changed files with 18 additions and 19 deletions
  1. +18
    -19
      src/main/org/apache/tools/ant/property/ResolvePropertyMap.java

+ 18
- 19
src/main/org/apache/tools/ant/property/ResolvePropertyMap.java View File

@@ -66,20 +66,31 @@ public class ResolvePropertyMap implements GetProperty {
}

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 implements GetProperty {
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);
}


Loading…
Cancel
Save