ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r954802 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/util/DOMElementWriter.java src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
Date Tue, 15 Jun 2010 10:43:38 GMT
Author: bodewig
Date: Tue Jun 15 10:43:37 2010
New Revision: 954802

URL: http://svn.apache.org/viewvc?rev=954802&view=rev
Log:
unconditionally encode & as & in DOMElementWriter.  PR 49404

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=954802&r1=954801&r2=954802&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Jun 15 10:43:37 2010
@@ -16,6 +16,14 @@ Changes that could break older environme
 
  * Removed ant-nodeps.jar; it is now merged into ant.jar.
 
+ * DOMElementWriter#encode used to employ special code before encoding
+   ampersands so that { remained { rather than being turned
+   into {.  This is no longer the case, ampersands will now
+   be encoded unconditionally.
+   This affects <echoxml> task as well as the XML logger or JUnit
+   formatter where ampersands will now always get encoded.
+   Bugzilla Report 49404.
+
 Fixed bugs:
 -----------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java?rev=954802&r1=954801&r2=954802&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java Tue Jun 15 10:43:37
2010
@@ -429,13 +429,7 @@ public class DOMElementWriter {
                 sb.append("&quot;");
                 break;
             case '&':
-                int nextSemi = value.indexOf(";", i);
-                if (nextSemi < 0
-                    || !isReference(value.substring(i, nextSemi + 1))) {
-                    sb.append("&amp;");
-                } else {
-                    sb.append('&');
-                }
+                sb.append("&amp;");
                 break;
             default:
                 if (isLegalCharacter(c)) {

Modified: ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml?rev=954802&r1=954801&r2=954802&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/xmlformatter-test.xml Tue Jun
15 10:43:37 2010
@@ -79,14 +79,12 @@ public class A extends TestCase {
     </junit>
     <xmlvalidate file="${output}/TEST-org.example.A.xml"
                  lenient="true"/>
-    <!--
     <au:assertResourceContains
         resource="${output}/TEST-org.example.A.xml"
         value="message=&quot;&amp;amp;amp;&amp;amp;"/>
     <au:assertResourceContains
         resource="${output}/TEST-org.example.A.xml"
-        value="message=AssertionFailedError: &amp;amp;&amp;"/>
-    -->
+        value="AssertionFailedError: &amp;amp;amp;&amp;"/>
   </target>
 
 </project>

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java?rev=954802&r1=954801&r2=954802&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java Tue
Jun 15 10:43:37 2010
@@ -53,17 +53,17 @@ public class DOMElementWriterTest extend
     }
 
     public void testEncode() {
-        assertEquals("&#20;", w.encode("&#20;"));
-        assertEquals("&#x20;", w.encode("&#x20;"));
-        assertEquals("&#xA0;", w.encode("&#xA0;"));
+        assertEquals("&amp;#20;", w.encode("&#20;"));
+        assertEquals("&amp;#x20;", w.encode("&#x20;"));
+        assertEquals("&amp;#xA0;", w.encode("&#xA0;"));
         assertEquals("&amp;#A0;", w.encode("&#A0;"));
         assertEquals("20;", w.encode("20;"));
         assertEquals("&amp;#20", w.encode("&#20"));
-        assertEquals("&quot;", w.encode("&quot;"));
-        assertEquals("&apos;", w.encode("&apos;"));
-        assertEquals("&gt;", w.encode("&gt;"));
-        assertEquals("&lt;", w.encode("&lt;"));
-        assertEquals("&amp;", w.encode("&amp;"));
+        assertEquals("&amp;quot;", w.encode("&quot;"));
+        assertEquals("&amp;apos;", w.encode("&apos;"));
+        assertEquals("&amp;gt;", w.encode("&gt;"));
+        assertEquals("&amp;lt;", w.encode("&lt;"));
+        assertEquals("&amp;amp;", w.encode("&amp;"));
         assertEquals("&quot;", w.encode("\""));
         assertEquals("&lt;", w.encode("<"));
         assertEquals("&amp;", w.encode("&"));



Mime
View raw message