Browse Source

MacroDef did not allow attributes named 'description'.

PR: 27175
Reported by: Jayson Raymond


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276144 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
a0c2e2864e
4 changed files with 22 additions and 0 deletions
  1. +2
    -0
      WHATSNEW
  2. +12
    -0
      src/etc/testcases/taskdefs/macrodef.xml
  3. +3
    -0
      src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
  4. +5
    -0
      src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java

+ 2
- 0
WHATSNEW View File

@@ -48,6 +48,8 @@ Fixed bugs:

* SQL task did not work with Informix IDS 9.2. Bugzilla Report 27162.

* MacroDef did not allow attributes named 'description'. Bugzilla Report 27175.

Other changes:
--------------



+ 12
- 0
src/etc/testcases/taskdefs/macrodef.xml View File

@@ -156,4 +156,16 @@
</macrodef>
<escape a="avalue" b="bvalue"/>
</target>

<target name="attribute.description">
<macrodef name="d">
<attribute name="description"/>
<attribute name="d" default="p"/>
<sequential>
<echo>description is @{description}</echo>
</sequential>
</macrodef>
<d description="hello world"/>
</target>

</project>

+ 3
- 0
src/main/org/apache/tools/ant/taskdefs/MacroInstance.java View File

@@ -282,6 +282,9 @@ public class MacroInstance extends Task implements DynamicConfigurator {
for (Iterator i = macroDef.getAttributes().iterator(); i.hasNext();) {
MacroDef.Attribute attribute = (MacroDef.Attribute) i.next();
String value = (String) map.get(attribute.getName());
if (value == null && "description".equals(attribute.getName())) {
value = getDescription();
}
if (value == null) {
value = attribute.getDefault();
value = macroSubs(value, localProperties);


+ 5
- 0
src/testcases/org/apache/tools/ant/taskdefs/MacroDefTest.java View File

@@ -104,5 +104,10 @@ public class MacroDefTest extends BuildFileTest {
"escape",
"a@b or a@b is avalue@bvalue");
}
public void testAttributeDescription() {
expectLog(
"attribute.description",
"description is hello world");
}
}


Loading…
Cancel
Save