Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f6af6d

Browse files
committed
Minor style cleanup
1 parent 4bc3e9b commit 0f6af6d

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/test/java/com/fasterxml/aalto/sax/TestSaxWriter.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
import java.io.ByteArrayOutputStream;
77

8-
public class TestSaxWriter extends base.BaseTestCase {
9-
10-
public void testSurrogateMemory1() throws Exception {
8+
public class TestSaxWriter extends base.BaseTestCase
9+
{
10+
public void testSplitSurrogateWithAttributeValue() throws Exception
11+
{
1112
// This test aims to produce the
1213
// javax.xml.stream.XMLStreamException: Incomplete surrogate pair in content: first char 0xd835, second 0x78
1314
// error message. Before fixing the respective issue, it was provoked by a multi-byte character
@@ -16,12 +17,13 @@ public void testSurrogateMemory1() throws Exception {
1617
// of the original multi-byte character with the first character in the third buffer because
1718
// ByteXmlWriter#_surrogate was not set back to 0 after writing the original multi-byte character.
1819
StringBuilder testText = new StringBuilder();
19-
for (int i = 0; i < 511; i++)
20+
for (int i = 0; i < 511; i++) {
2021
testText.append('x');
22+
}
2123
testText.append("\uD835\uDFCE");
22-
for (int i = 0; i < 512; i++)
24+
for (int i = 0; i < 512; i++) {
2325
testText.append('x');
24-
26+
}
2527
WriterConfig writerConfig = new WriterConfig();
2628
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
2729
Utf8XmlWriter writer = new Utf8XmlWriter(writerConfig, byteArrayOutputStream);
@@ -30,19 +32,20 @@ public void testSurrogateMemory1() throws Exception {
3032
writer.writeStartTagEnd();
3133
writer.writeEndTag(writer.constructName("testelement"));
3234
writer.close(false);
33-
3435
}
3536

36-
public void testSurrogateMemory2() throws Exception {
37+
public void testSplitSurrogateWithAttributeValue2() throws Exception
38+
{
3739
// This test aims to produce the
3840
// java.io.IOException: Unpaired surrogate character (0xd835)
3941
// error message. Before fixing the respective issue, it was provoked by a multi-byte character
4042
// where the first byte was exactly at the end of the internal reading buffer and the next
4143
// reading buffer was enough to write all the remaining data. Then, by the missing reset of
4244
// ByteXmlWriter#_surrogate, the code expected another multi-byte surrogate that never came.
4345
StringBuilder testText = new StringBuilder();
44-
for (int i = 0; i < 511; i++)
46+
for (int i = 0; i < 511; i++) {
4547
testText.append('x');
48+
}
4649
testText.append("\uD835\uDFCE");
4750

4851
WriterConfig writerConfig = new WriterConfig();
@@ -55,18 +58,21 @@ public void testSurrogateMemory2() throws Exception {
5558
writer.close(false);
5659
}
5760

58-
public void testSurrogateMemory3() throws Exception {
61+
public void testSplitSurrogateWithCData() throws Exception
62+
{
5963
// This test aims to produce the
6064
// javax.xml.stream.XMLStreamException: Incomplete surrogate pair in content: first char 0xdfce, second 0x78
6165
// error message. The issue was similar to the one described in testSurrogateMemory1(), except it happened in
6266
// ByteXmlWriter#writeCDataContents(), where check for existing _surrogate was missing prior to the fix,
6367
// as opposed to ByteXmlWriter#writeCharacters().
6468
StringBuilder testText = new StringBuilder();
65-
for (int i = 0; i < 511; i++)
69+
for (int i = 0; i < 511; i++) {
6670
testText.append('x');
71+
}
6772
testText.append("\uD835\uDFCE");
68-
for (int i = 0; i < 512; i++)
73+
for (int i = 0; i < 512; i++) {
6974
testText.append('x');
75+
}
7076

7177
WriterConfig writerConfig = new WriterConfig();
7278
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -76,7 +82,5 @@ public void testSurrogateMemory3() throws Exception {
7682
writer.writeStartTagEnd();
7783
writer.writeEndTag(writer.constructName("testelement"));
7884
writer.close(false);
79-
8085
}
81-
8286
}

0 commit comments

Comments
 (0)