Browse Source

NPE in ExpandProperties when input is empty. PR 53626

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1372266 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 13 years ago
parent
commit
b8c35567ee
3 changed files with 26 additions and 3 deletions
  1. +4
    -0
      WHATSNEW
  2. +7
    -3
      src/main/org/apache/tools/ant/filters/ExpandProperties.java
  3. +15
    -0
      src/tests/antunit/filters/expandproperties-test.xml

+ 4
- 0
WHATSNEW View File

@@ -50,6 +50,10 @@ Fixed bugs:
handledirsep="true".
Bugzilla Report 53399.

* <expandproperties> filter caused a NullPointerExcpetion when input
was empty.
Bugzilla Report 53626.

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



+ 7
- 3
src/main/org/apache/tools/ant/filters/ExpandProperties.java View File

@@ -107,9 +107,13 @@ public final class ExpandProperties
}
};
}
buffer = new ParseProperties(project, PropertyHelper.getPropertyHelper(project)
.getExpanders(), getProperty).parseProperties(data).toString()
.toCharArray();
Object expanded = new ParseProperties(project, PropertyHelper
.getPropertyHelper(project)
.getExpanders(),
getProperty)
.parseProperties(data);
buffer = expanded == null ? new char[0]
: expanded.toString().toCharArray();
}
if (index < buffer.length) {
return buffer[index++];


+ 15
- 0
src/tests/antunit/filters/expandproperties-test.xml View File

@@ -74,4 +74,19 @@
</au:assertTrue>
</target>

<target name="testEmptyResource"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53626">
<au:assertTrue>
<resourcesmatch>
<string value="" />
<concat>
<string value="" />
<filterchain>
<expandproperties />
</filterchain>
</concat>
</resourcesmatch>
</au:assertTrue>
</target>

</project>

Loading…
Cancel
Save