diff --git a/WHATSNEW b/WHATSNEW index 360578c64..75d04dc34 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -226,6 +226,9 @@ Fixed bugs: than numbers, letters, hyphen or underscore properly. Bugzilla Report 45820. + * could miss multi-character begin tokens in some cases. + Bugzilla Report 45094. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/FilterSet.java b/src/main/org/apache/tools/ant/types/FilterSet.java index 63c829886..ee322d974 100644 --- a/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/src/main/org/apache/tools/ant/types/FilterSet.java @@ -537,9 +537,13 @@ public class FilterSet extends DataType implements Cloneable { i = index + beginToken.length() + token.length() + endToken.length(); } else { - // just append beginToken and search further - b.append(beginToken); - i = index + beginToken.length(); + // just append first character of beginToken + // and search further + // we can't skip the complete beginToken since + // it may contain the start of another + // candidate begin token (Bugzilla 45094) + b.append(beginToken.charAt(0)); + i = index + 1; } index = line.indexOf(beginToken, i); } diff --git a/src/tests/antunit/types/filterset-test.xml b/src/tests/antunit/types/filterset-test.xml index 99c2e152b..506f3be1a 100644 --- a/src/tests/antunit/types/filterset-test.xml +++ b/src/tests/antunit/types/filterset-test.xml @@ -41,4 +41,23 @@ actual="${afterfiltering}"/> + + + + + + + + + + + + + + + + +