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 2012/08/13 07:45:10 UTC
svn commit: r1372266 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/filters/ExpandProperties.java
src/tests/antunit/filters/expandproperties-test.xml
Author: bodewig
Date: Mon Aug 13 05:45:10 2012
New Revision: 1372266
URL: http://svn.apache.org/viewvc?rev=1372266&view=rev
Log:
NPE in ExpandProperties when input is empty. PR 53626
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/filters/ExpandProperties.java
ant/core/trunk/src/tests/antunit/filters/expandproperties-test.xml
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1372266&r1=1372265&r2=1372266&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Aug 13 05:45:10 2012
@@ -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:
--------------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ExpandProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ExpandProperties.java?rev=1372266&r1=1372265&r2=1372266&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ExpandProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ExpandProperties.java Mon Aug 13 05:45:10 2012
@@ -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++];
Modified: ant/core/trunk/src/tests/antunit/filters/expandproperties-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/filters/expandproperties-test.xml?rev=1372266&r1=1372265&r2=1372266&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/filters/expandproperties-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/filters/expandproperties-test.xml Mon Aug 13 05:45:10 2012
@@ -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>