Browse Source

prefixValues=false in <property> doesn't work - PR 54769

yet another part of the never ending nested property expansion story.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554614 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 11 years ago
parent
commit
169becaf51
3 changed files with 32 additions and 1 deletions
  1. +7
    -0
      WHATSNEW
  2. +10
    -1
      src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
  3. +15
    -0
      src/tests/antunit/taskdefs/property-test.xml

+ 7
- 0
WHATSNEW View File

@@ -4,6 +4,13 @@ Changes from Ant 1.9.3 TO current
Changes that could break older environments:
-------------------------------------------

* the prefixValues attribute of <property> didn't work as expected
when set to false (the default).
It is quite likely existing build files relied on the wrong
behavior and expect Ant to resolve the value side against the
properties defined in the property file itself - these build files
must now explicitly set the prefixValues attribute to true.
Bugzilla Report 54769

Fixed bugs:
-----------


+ 10
- 1
src/main/org/apache/tools/ant/property/ResolvePropertyMap.java View File

@@ -87,10 +87,19 @@ public class ResolvePropertyMap implements GetProperty {
}

seen.add(name);

String recursiveCallKey = name;
if (prefix != null && !expandingLHS && !prefixValues) {
// only look up unprefixed properties inside the map
// if prefixValues is true or we are expanding the key
// itself
recursiveCallKey = prefix + 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));
return parseProperties.parseProperties((String) map.get(recursiveCallKey));
} finally {
seen.remove(name);
}


+ 15
- 0
src/tests/antunit/taskdefs/property-test.xml View File

@@ -135,4 +135,19 @@ y=$${x}
<property file="${input}/x.properties" prefix="foo"/>
<au:assertPropertyEquals name="foo.y" value="x"/>
</target>

<target name="testInternalExpansionWithPrefixOnlyExpandsWhenPrefixValuesIsTrue"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=54769">
<mkdir dir="${input}"/>
<echo file="${input}/x.properties"><![CDATA[
a=A
b=$${a}
]]></echo>
<property file="${input}/x.properties" prefix="foo" prefixValues="true"/>
<au:assertPropertyEquals name="foo.b" value="A"/>
<property file="${input}/x.properties" prefix="bar" prefixValues="false"/>
<au:assertPropertyEquals name="bar.b" value="$${a}"/>
<property file="${input}/x.properties" prefix="baz"/>
<au:assertPropertyEquals name="baz.b" value="$${a}"/>
</target>
</project>

Loading…
Cancel
Save