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 2014/01/01 13:13:06 UTC
svn commit: r1554614 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
src/tests/antunit/taskdefs/property-test.xml
Author: bodewig
Date: Wed Jan 1 12:13:05 2014
New Revision: 1554614
URL: http://svn.apache.org/r1554614
Log:
prefixValues=false in <property> doesn't work - PR 54769
yet another part of the never ending nested property expansion story.
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
ant/core/trunk/src/tests/antunit/taskdefs/property-test.xml
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1554614&r1=1554613&r2=1554614&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Jan 1 12:13:05 2014
@@ -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:
-----------
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=1554614&r1=1554613&r2=1554614&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 Jan 1 12:13:05 2014
@@ -87,10 +87,19 @@ public class ResolvePropertyMap implemen
}
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);
}
Modified: ant/core/trunk/src/tests/antunit/taskdefs/property-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/property-test.xml?rev=1554614&r1=1554613&r2=1554614&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/property-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/property-test.xml Wed Jan 1 12:13:05 2014
@@ -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>