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 2008/09/25 17:28:14 UTC
svn commit: r699002 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/types/FilterSet.java
src/tests/antunit/types/filterset-test.xml
Author: bodewig
Date: Thu Sep 25 08:28:14 2008
New Revision: 699002
URL: http://svn.apache.org/viewvc?rev=699002&view=rev
Log:
don't skip the full begin token since it may contain the start of the real begin token. PR 45094.
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java
ant/core/trunk/src/tests/antunit/types/filterset-test.xml
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=699002&r1=699001&r2=699002&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Sep 25 08:28:14 2008
@@ -226,6 +226,9 @@
than numbers, letters, hyphen or underscore properly.
Bugzilla Report 45820.
+ * <filterset> could miss multi-character begin tokens in some cases.
+ Bugzilla Report 45094.
+
Other changes:
--------------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java?rev=699002&r1=699001&r2=699002&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/FilterSet.java Thu Sep 25 08:28:14 2008
@@ -537,9 +537,13 @@
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);
}
Modified: ant/core/trunk/src/tests/antunit/types/filterset-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/filterset-test.xml?rev=699002&r1=699001&r2=699002&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/filterset-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/filterset-test.xml Thu Sep 25 08:28:14 2008
@@ -41,4 +41,23 @@
actual="${afterfiltering}"/>
</target>
+ <!-- https://issues.apache.org/bugzilla/show_bug.cgi?id=45094 -->
+ <target name="testOverlappingMulticharToken">
+ <mkdir dir="${output}"/>
+ <copy todir="${output}">
+ <string value="@@USER@@@@@HOST@@" />
+ <mergemapper to="filterset-output.txt" />
+ <filterset begintoken="@@" endtoken="@@">
+ <filter token="USER" value="user" />
+ <filter token="HOST" value="host" />
+ </filterset>
+ </copy>
+
+ <loadfile property="afterfiltering" srcFile="${output}/filterset-output.txt"/>
+
+ <au:assertEquals
+ expected="user@host"
+ actual="${afterfiltering}"/>
+ </target>
+
</project>