diff --git a/WHATSNEW b/WHATSNEW index 03a1022a4..eded0c2bf 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -50,6 +50,10 @@ Fixed bugs: handledirsep="true". Bugzilla Report 53399. + * filter caused a NullPointerExcpetion when input + was empty. + Bugzilla Report 53626. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/filters/ExpandProperties.java b/src/main/org/apache/tools/ant/filters/ExpandProperties.java index 0ca288edb..524a799b1 100644 --- a/src/main/org/apache/tools/ant/filters/ExpandProperties.java +++ b/src/main/org/apache/tools/ant/filters/ExpandProperties.java @@ -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++]; diff --git a/src/tests/antunit/filters/expandproperties-test.xml b/src/tests/antunit/filters/expandproperties-test.xml index 44195fe3c..5dff8320c 100644 --- a/src/tests/antunit/filters/expandproperties-test.xml +++ b/src/tests/antunit/filters/expandproperties-test.xml @@ -74,4 +74,19 @@ + + + + + + + + + + + + + +