Browse Source

sometimes an infinite recursion of filters is flagged when there is none. PR 44226. Submitted by Adam Bryzak.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@686775 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
e713682ea6
5 changed files with 22 additions and 8 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +3
    -0
      src/main/org/apache/tools/ant/types/FilterSet.java
  5. +10
    -8
      src/tests/antunit/types/filterset-test.xml

+ 1
- 0
CONTRIBUTORS View File

@@ -1,6 +1,7 @@
Amongst other, the following people contributed to ant:

Adam Blinkinsop
Adam Bryzak
Aleksandr Ishutin
Alexey Panchenko
Alexey Solofnenko


+ 4
- 0
WHATSNEW View File

@@ -154,6 +154,10 @@ Fixed bugs:
was not set.
Bugzilla Report 45245.

* <filterset> sometimes incorrectly flagged infinite recursions of
filter tokens
Bugzilla Report 44226.

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



+ 4
- 0
contributors.xml View File

@@ -34,6 +34,10 @@
<first>Adam</first>
<last>Blinkinsop</last>
</name>
<name>
<first>Adam</first>
<last>Bryzak</last>
</name>
<name>
<first>Aleksandr</first>
<last>Ishutin</last>


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

@@ -593,6 +593,9 @@ public class FilterSet extends DataType implements Cloneable {
duplicateToken = false;
}
}
} else if (passedTokens.size() > 0) {
// remove last seen token when crawling out of recursion
passedTokens.remove(passedTokens.size() - 1);
}
recurseDepth--;
return value;


+ 10
- 8
src/tests/antunit/types/filterset-test.xml View File

@@ -15,27 +15,29 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns:au="antlib:org.apache.ant.antunit">
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">

<import file="../antunit-base.xml" />

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

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

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

<au:assertEquals
expected="aaa${br}bbb${br}aaa:bbb${br}aaa:bbb:aaa:bbb${br}"
actual="${afterfiltering}"/>
</target>

<target name="tearDown">


Loading…
Cancel
Save