mbenson 2004/02/19 13:14:16
Modified: src/testcases/org/apache/tools/ant/filters
TokenFilterTest.java
src/main/org/apache/tools/ant/filters TokenFilter.java
src/etc/testcases/filters tokenfilter.xml
. WHATSNEW
Log:
TokenFilter.ReplaceString only replaced the first occurrence.
Revision Changes Path
1.7 +8 -0
ant/src/testcases/org/apache/tools/ant/filters/TokenFilterTest.java
Index: TokenFilterTest.java
===================================================================
RCS file:
/home/cvs/ant/src/testcases/org/apache/tools/ant/filters/TokenFilterTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TokenFilterTest.java 9 Feb 2004 21:05:41 -0000 1.6
+++ TokenFilterTest.java 19 Feb 2004 21:14:16 -0000 1.7
@@ -82,6 +82,10 @@
"this is the moon");
}
+ public void testReplaceStrings() throws IOException {
+ expectLogContaining("replacestrings", "bar bar bar");
+ }
+
public void testContainsString() throws IOException {
String contents = getFileString(
"containsstring", "result/containsstring");
@@ -137,6 +141,10 @@
String contents = getFileString(
"filterreplacestring", "result/filterreplacestring");
assertStringContains(contents, "This is the moon");
+ }
+
+ public void testFilterReplaceStrings() throws IOException {
+ expectLogContaining("filterreplacestrings", "bar bar bar");
}
public void testContainsRegex() throws IOException {
1.16 +1 -1
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
Index: TokenFilter.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TokenFilter.java 9 Feb 2004 21:05:17 -0000 1.15
+++ TokenFilter.java 19 Feb 2004 21:14:16 -0000 1.16
@@ -527,7 +527,7 @@
// search again
start = found + from.length();
- found = line.indexOf(line, start);
+ found = line.indexOf(from, start);
}
// write the remaining characters
1.4 +20 -0 ant/src/etc/testcases/filters/tokenfilter.xml
Index: tokenfilter.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/filters/tokenfilter.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tokenfilter.xml 28 May 2003 15:31:07 -0000 1.3
+++ tokenfilter.xml 19 Feb 2004 21:14:16 -0000 1.4
@@ -67,6 +67,15 @@
</concat>
</target>
+ <target name="filterreplacestrings">
+ <concat>
+ foo foo foo
+ <filterchain>
+ <replacestring from="foo" to="bar"/>
+ </filterchain>
+ </concat>
+ </target>
+
<target name="stringtokenizer">
<concat destfile="result/input">
This is a number
@@ -129,6 +138,17 @@
<filterchain>
<tokenfilter>
<replacestring from="sun" to="moon"/>
+ </tokenfilter>
+ </filterchain>
+ </concat>
+ </target>
+
+ <target name="replacestrings">
+ <concat>
+ foo foo foo
+ <filterchain>
+ <tokenfilter>
+ <replacestring from="foo" to="bar"/>
</tokenfilter>
</filterchain>
</concat>
1.547 +2 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.546
retrieving revision 1.547
diff -u -r1.546 -r1.547
--- WHATSNEW 19 Feb 2004 11:01:20 -0000 1.546
+++ WHATSNEW 19 Feb 2004 21:14:16 -0000 1.547
@@ -21,6 +21,8 @@
* macrodef @@ escaping was broken. Bugzilla Report 27069.
+* replacestring tokenfilter only replaced the first occurrence.
+
Other changes:
--------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]