@@ -60,11 +60,7 @@ public void testSplitSurrogateWithAttributeValue2() throws Exception
60
60
61
61
public void testSplitSurrogateWithCData () throws Exception
62
62
{
63
- // This test aims to produce the
64
- // javax.xml.stream.XMLStreamException: Incomplete surrogate pair in content: first char 0xdfce, second 0x78
65
- // error message. The issue was similar to the one described in testSurrogateMemory1(), except it happened in
66
- // ByteXmlWriter#writeCDataContents(), where check for existing _surrogate was missing prior to the fix,
67
- // as opposed to ByteXmlWriter#writeCharacters().
63
+ // Modification of "testSplitSurrogateWithAttributeValue()" but for CDATA
68
64
StringBuilder testText = new StringBuilder ();
69
65
for (int i = 0 ; i < 511 ; i ++) {
70
66
testText .append ('x' );
@@ -83,4 +79,27 @@ public void testSplitSurrogateWithCData() throws Exception
83
79
writer .writeEndTag (writer .constructName ("testelement" ));
84
80
writer .close (false );
85
81
}
82
+
83
+
84
+ public void testSplitSurrogateWithComment () throws Exception
85
+ {
86
+ // Modification of "testSplitSurrogateWithAttributeValue()" but for Comment
87
+ StringBuilder testText = new StringBuilder ();
88
+ for (int i = 0 ; i < 511 ; i ++) {
89
+ testText .append ('x' );
90
+ }
91
+ testText .append ("\uD835 \uDFCE " );
92
+ for (int i = 0 ; i < 512 ; i ++) {
93
+ testText .append ('x' );
94
+ }
95
+
96
+ WriterConfig writerConfig = new WriterConfig ();
97
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ();
98
+ Utf8XmlWriter writer = new Utf8XmlWriter (writerConfig , byteArrayOutputStream );
99
+ writer .writeStartTagStart (writer .constructName ("testelement" ));
100
+ writer .writeComment (testText .toString ());
101
+ writer .writeStartTagEnd ();
102
+ writer .writeEndTag (writer .constructName ("testelement" ));
103
+ writer .close (false );
104
+ }
86
105
}
0 commit comments