ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r536592 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Concat.java src/tests/antunit/taskdefs/concat-test.xml
Date Wed, 09 May 2007 17:12:27 GMT
Author: mbenson
Date: Wed May  9 10:12:26 2007
New Revision: 536592

URL: http://svn.apache.org/viewvc?view=rev&rev=536592
Log:
concat fixlastline/nested text regression; PR 42369

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
    ant/core/trunk/src/tests/antunit/taskdefs/concat-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=536592&r1=536591&r2=536592
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed May  9 10:12:26 2007
@@ -70,6 +70,9 @@
 
 * handle null result of system getProperty(). Bugzilla 42334.
 
+* Regression: concat fixlastline="true" should not have applied to
+  nested text, but did in Ant 1.7.0. Bugzilla 42369.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java?view=diff&rev=536592&r1=536591&r2=536592
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java Wed May  9 10:12:26
2007
@@ -265,7 +265,7 @@
                 int ch = getReader().read();
                 if (ch == -1) {
                     nextReader();
-                    if (fixLastLine && isMissingEndOfLine()) {
+                    if (isFixLastLine() && isMissingEndOfLine()) {
                         needAddSeparator = true;
                         lastPos = 0;
                     }
@@ -307,12 +307,12 @@
                 int nRead = getReader().read(cbuf, off, len);
                 if (nRead == -1 || nRead == 0) {
                     nextReader();
-                    if (fixLastLine && isMissingEndOfLine()) {
+                    if (isFixLastLine() && isMissingEndOfLine()) {
                         needAddSeparator = true;
                         lastPos = 0;
                     }
                 } else {
-                    if (fixLastLine) {
+                    if (isFixLastLine()) {
                         for (int i = nRead;
                                  i > (nRead - lastChars.length);
                                  --i) {
@@ -369,6 +369,10 @@
             }
             return false;
         }
+
+        private boolean isFixLastLine() {
+            return fixLastLine && textBuffer == null;
+        }
     }
 
     private class ConcatResource extends Resource {
@@ -887,10 +891,8 @@
      * for &quot;ignorable whitespace&quot; as well.</p>
      */
     private void sanitizeText() {
-        if (textBuffer != null) {
-            if (textBuffer.substring(0).trim().length() == 0) {
-                textBuffer = null;
-            }
+        if (textBuffer != null && "".equals(textBuffer.toString().trim())) {
+            textBuffer = null;
         }
     }
 

Modified: ant/core/trunk/src/tests/antunit/taskdefs/concat-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/concat-test.xml?view=diff&rev=536592&r1=536591&r2=536592
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/concat-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/concat-test.xml Wed May  9 10:12:26 2007
@@ -1,4 +1,6 @@
-<project xmlns:au="antlib:org.apache.ant.antunit">
+<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
+  <import file="../antunit-base.xml" />
+
   <target name="tearDown">
     <delete file="binaryAppendDest" />
     <delete file="encodeStringDest" />
@@ -31,6 +33,15 @@
       <resourcesmatch astext="true">
         <file file="utf-16.expected" />
         <file file="encodeStringDest" />
+      </resourcesmatch>
+    </au:assertTrue>
+  </target>
+
+  <target name="testDoNotFixNestedText" description="Bugzilla 42369">
+    <au:assertTrue>
+      <resourcesmatch>
+        <string>foo</string>
+        <concat fixlastline="true">foo</concat>
       </resourcesmatch>
     </au:assertTrue>
   </target>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message