git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273801 13f79535-47bb-0310-9956-ffa450edef68master
@@ -17,6 +17,8 @@ Changes that could break older environments: | |||||
* The <script> task now requires Apache BSF instead of the older IBM | * The <script> task now requires Apache BSF instead of the older IBM | ||||
version. See <http://jakarta.apache.org/bsf/> | version. See <http://jakarta.apache.org/bsf/> | ||||
* <xmlproperty> will no longer fail if the file to be loaded doesn't exist. | |||||
Fixed bugs: | Fixed bugs: | ||||
----------- | ----------- | ||||
* <translate> was not ignoring comment lines. | * <translate> was not ignoring comment lines. | ||||
@@ -168,8 +170,6 @@ Other changes: | |||||
works for the code generated by the Sun java compiler. It may not work for | works for the code generated by the Sun java compiler. It may not work for | ||||
all compilers. | all compilers. | ||||
* <xmlproperty> will no longer fail if the file to be loaded doesn't exist. | |||||
Changes from Ant 1.5.1Beta1 to 1.5.1 | Changes from Ant 1.5.1Beta1 to 1.5.1 | ||||
==================================== | ==================================== | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -242,8 +242,15 @@ public class DOMElementWriter { | |||||
/** | /** | ||||
* Drop characters that are illegal in XML documents. | * Drop characters that are illegal in XML documents. | ||||
* | * | ||||
* <p>Also ensure that we are not including an <code>]]></code> | |||||
* marker by replacing that sequence with | |||||
* <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>.</p> | |||||
* 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 | |||||
* 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) { | ||||
sb.setLength(0); | sb.setLength(0); | ||||
@@ -253,7 +260,18 @@ public class DOMElementWriter { | |||||
sb.append(c); | sb.append(c); | ||||
} | } | ||||
} | } | ||||
return sb.toString(); | |||||
String result = sb.toString(); | |||||
int cdEnd = result.indexOf("]]>"); | |||||
while (cdEnd != -1) { | |||||
sb.setLength(cdEnd); | |||||
sb.append("&x5d;&x5d;>") | |||||
.append(result.substring(cdEnd+3)); | |||||
result = sb.toString(); | |||||
cdEnd = result.indexOf("]]>"); | |||||
} | |||||
return result; | |||||
} | } | ||||
/** | /** | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -119,4 +119,15 @@ public class DOMElementWriterTest extends TestCase { | |||||
assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD')); | assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD')); | ||||
assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE')); | assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE')); | ||||
} | } | ||||
public void testCDATAEndEncoding() { | |||||
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", | |||||
w.encodedata("A]]>B]]>C")); | |||||
} | |||||
} | } |