git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273804 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -244,12 +244,12 @@ public class DOMElementWriter { | |||||
| * | * | ||||
| * <p>Also ensure that we are not including an <code>]]></code> | * <p>Also ensure that we are not including an <code>]]></code> | ||||
| * marker by replacing that sequence with | * marker by replacing that sequence with | ||||
| * <code>&x5d;&x5d;&gt;</code>.</p> | |||||
| * <code>&#x5d;&#x5d;&gt;</code>.</p> | |||||
| * | * | ||||
| * <p>See XML 1.0 2.2 <a | * <p>See XML 1.0 2.2 <a | ||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets">http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a>. and | |||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets">http://www.w3.org/TR/1998/REC-xml-19980210#charsets</a> and | |||||
| * 2.7 <a | * 2.7 <a | ||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect">http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect</a></p> | |||||
| * href="http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect">http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect</a>.</p> | |||||
| */ | */ | ||||
| public String encodedata(final String value) { | public String encodedata(final String value) { | ||||
| @@ -265,7 +265,7 @@ public class DOMElementWriter { | |||||
| int cdEnd = result.indexOf("]]>"); | int cdEnd = result.indexOf("]]>"); | ||||
| while (cdEnd != -1) { | while (cdEnd != -1) { | ||||
| sb.setLength(cdEnd); | sb.setLength(cdEnd); | ||||
| sb.append("&x5d;&x5d;>") | |||||
| sb.append("]]>") | |||||
| .append(result.substring(cdEnd+3)); | .append(result.substring(cdEnd+3)); | ||||
| result = sb.toString(); | result = sb.toString(); | ||||
| cdEnd = result.indexOf("]]>"); | cdEnd = result.indexOf("]]>"); | ||||
| @@ -123,11 +123,11 @@ public class DOMElementWriterTest extends TestCase { | |||||
| public void testCDATAEndEncoding() { | public void testCDATAEndEncoding() { | ||||
| assertEquals("]>", w.encodedata("]>")); | assertEquals("]>", w.encodedata("]>")); | ||||
| assertEquals("]]", w.encodedata("]]")); | assertEquals("]]", w.encodedata("]]")); | ||||
| assertEquals("&x5d;&x5d;>", w.encodedata("]]>")); | |||||
| assertEquals("&x5d;&x5d;>A", w.encodedata("]]>A")); | |||||
| assertEquals("A&x5d;&x5d;>", w.encodedata("A]]>")); | |||||
| assertEquals("A&x5d;&x5d;>A", w.encodedata("A]]>A")); | |||||
| assertEquals("A&x5d;&x5d;>B&x5d;&x5d;>C", | |||||
| assertEquals("]]>", w.encodedata("]]>")); | |||||
| assertEquals("]]>A", w.encodedata("]]>A")); | |||||
| assertEquals("A]]>", w.encodedata("A]]>")); | |||||
| assertEquals("A]]>A", w.encodedata("A]]>A")); | |||||
| assertEquals("A]]>B]]>C", | |||||
| w.encodedata("A]]>B]]>C")); | w.encodedata("A]]>B]]>C")); | ||||
| } | } | ||||
| } | } | ||||