From 3d8e3a89d4098dca994cd5590e78794be11894e8 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 25 Sep 2008 15:28:14 +0000 Subject: [PATCH] don't skip the full begin token since it may contain the start of the real begin token. PR 45094. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@699002 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../org/apache/tools/ant/types/FilterSet.java | 10 +++++++--- src/tests/antunit/types/filterset-test.xml | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) 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}"/> + + + + + + + + + + + + + + + + +