Browse Source

fix NPE in recursive filtering. BZ 41086.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@481041 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
f001fcba2b
3 changed files with 33 additions and 2 deletions
  1. +3
    -0
      WHATSNEW
  2. +2
    -2
      src/main/org/apache/tools/ant/types/FilterSet.java
  3. +28
    -0
      src/tests/antunit/types/filterset-test.xml

+ 3
- 0
WHATSNEW View File

@@ -28,6 +28,9 @@ Fixed bugs:
* dependset failed if the basedir of a target fileset did not exist.
Bugzilla 40916.

* Recursive filtering encountered NullPointerExceptions under certain
circumstances. Bugzilla 41086.

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



+ 2
- 2
src/main/org/apache/tools/ant/types/FilterSet.java View File

@@ -581,8 +581,8 @@ public class FilterSet extends DataType implements Cloneable {
}
passedTokens.addElement(parent);
String value = iReplaceTokens(line);
if (value.indexOf(beginToken) == -1 && !duplicateToken) {
duplicateToken = false;
if (value.indexOf(beginToken) == -1 && !duplicateToken
&& recurseDepth == 1) {
passedTokens = null;
} else if (duplicateToken) {
// should always be the case...


+ 28
- 0
src/tests/antunit/types/filterset-test.xml View File

@@ -0,0 +1,28 @@
<project xmlns:au="antlib:org.apache.ant.antunit">

<property name="br" value="${line.separator}" />

<target name="testRecursionRegression">
<copy todir="${basedir}">
<string value="@a@${br}@b@${br}@c@${br}" />
<mergemapper to="filterset-output.txt" />
<filterset>
<filter token="a" value="aaa" />
<filter token="b" value="bbb" />
<filter token="c" value="@a@:@b@" />
</filterset>
</copy>

<au:assertTrue>
<resourcesmatch astext="true">
<file file="filterset-output.txt" />
<string value="aaa${br}bbb${br}aaa:bbb${br}" />
</resourcesmatch>
</au:assertTrue>
</target>

<target name="tearDown">
<delete file="filterset-output.txt" />
</target>

</project>

Loading…
Cancel
Save