mbenson     2004/04/20 15:09:04

  Modified:    .        Tag: ANT_16_BRANCH WHATSNEW
               src/testcases/org/apache/tools/ant/filters Tag:
                        ANT_16_BRANCH TokenFilterTest.java
               src/main/org/apache/tools/ant/filters Tag: ANT_16_BRANCH
                        TokenFilter.java
               src/etc/testcases/filters Tag: ANT_16_BRANCH tokenfilter.xml
  Log:
  Move replacestring tokenfilter fix to 1.6 branch
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.503.2.76 +2 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.75
  retrieving revision 1.503.2.76
  diff -u -r1.503.2.75 -r1.503.2.76
  --- WHATSNEW  20 Apr 2004 21:59:18 -0000      1.503.2.75
  +++ WHATSNEW  20 Apr 2004 22:09:04 -0000      1.503.2.76
  @@ -56,6 +56,8 @@
   
   * AntLikeTasksAtTopLevelTest failed on cygwin.
   
  +* replacestring tokenfilter only replaced the first occurrence.
  +
   Other changes:
   --------------
   
  
  
  
  No                   revision
  No                   revision
  1.3.2.5   +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.3.2.4
  retrieving revision 1.3.2.5
  diff -u -r1.3.2.4 -r1.3.2.5
  --- TokenFilterTest.java      9 Mar 2004 17:02:01 -0000       1.3.2.4
  +++ TokenFilterTest.java      20 Apr 2004 22:09:04 -0000      1.3.2.5
  @@ -81,6 +81,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");
  @@ -136,6 +140,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 {
  
  
  
  No                   revision
  No                   revision
  1.12.2.5  +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.12.2.4
  retrieving revision 1.12.2.5
  diff -u -r1.12.2.4 -r1.12.2.5
  --- TokenFilter.java  9 Mar 2004 17:01:31 -0000       1.12.2.4
  +++ TokenFilter.java  20 Apr 2004 22:09:04 -0000      1.12.2.5
  @@ -526,7 +526,7 @@
   
                   // search again
                   start = found + from.length();
  -                found = line.indexOf(line, start);
  +                found = line.indexOf(from, start);
               }
   
               // write the remaining characters
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +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.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- tokenfilter.xml   28 May 2003 15:31:07 -0000      1.3
  +++ tokenfilter.xml   20 Apr 2004 22:09:04 -0000      1.3.2.1
  @@ -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>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to