ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r781357 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/filters/ReplaceTokens.java src/tests/antunit/filters/replacetokens-test.xml
Date Wed, 03 Jun 2009 13:02:37 GMT
Author: bodewig
Date: Wed Jun  3 13:02:37 2009
New Revision: 781357

URL: http://svn.apache.org/viewvc?rev=781357&view=rev
Log:
replacetokens failed if stream ends in begintoken.  PR 47306.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
    ant/core/trunk/src/tests/antunit/filters/replacetokens-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=781357&r1=781356&r2=781357&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Jun  3 13:02:37 2009
@@ -371,6 +371,10 @@
    errors.
    Bugzilla Report 46829.
 
+ * The <replacetokens> filter threw an exception if the stream to
+   filter ended with a begin token.
+   Bugzilla Report 47306.
+
 Other changes:
 --------------
  * A HostInfo task was added performing information on hosts, including info on 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java?rev=781357&r1=781356&r2=781357&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java Wed Jun  3 13:02:37
2009
@@ -153,7 +153,11 @@
                     queuedData
                         = key.toString() + queuedData.substring(queueIndex);
                 }
-                queueIndex = 0;
+                if (queuedData.length() > 0) {
+                    queueIndex = 0;
+                } else {
+                    queueIndex = -1;
+                }
                 return beginToken;
             } else {
                 key.setLength(key.length() - 1);

Modified: ant/core/trunk/src/tests/antunit/filters/replacetokens-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/filters/replacetokens-test.xml?rev=781357&r1=781356&r2=781357&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/filters/replacetokens-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/filters/replacetokens-test.xml Wed Jun  3 13:02:37 2009
@@ -47,4 +47,22 @@
        resource="${output}/text.txt" value="Hello, Ant!"/>
   </target>
 
+  <target name="testFileEndsWithToken"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=47306"
+          depends="setUp">
+    <mkdir dir="${output}"/>
+    <echo file="${input}/test47306.txt">Hello@</echo>
+    <copy todir="${output}">
+      <fileset dir="${input}"/>
+      <filterchain>
+        <replacetokens>
+          <token key="foo" value="bar"/>
+        </replacetokens>
+      </filterchain>
+    </copy>
+    <au:assertFilesMatch
+       expected="${input}/test47306.txt"
+       actual="${output}/test47306.txt"/>
+  </target>
+
 </project>



Mime
View raw message