Skip to content

Commit 4f9af12

Browse files
committed
Resolve as many StAX unit test fails as possible
1 parent 118853b commit 4f9af12

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

core/src/java/org/jdom2/input/StAXStreamWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public void writeCharacters(final String chars) throws XMLStreamException {
460460
if (parent instanceof Element) {
461461
if (activetext != null) {
462462
activetext.append(chars);
463-
} else {
463+
} else if (chars.length() > 0) {
464464
activetext = factory.text(chars);
465465
factory.addContent(parent, activetext);
466466
}

test/src/java/org/jdom2/test/cases/output/TestStAXEventOutputter.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060

6161
@SuppressWarnings("javadoc")
6262
public final class TestStAXEventOutputter extends AbstractTestOutputter {
63+
64+
// ******************************************************************************
65+
// ******************************************************************************
66+
// StAX is really ugly - it breaks SurrogatePair handling with non-UTF8 encoding
67+
// As a result, some of these test cases fail in Recent Java versions
68+
// - most test*Surrogate*Pair tests.
69+
// ******************************************************************************
70+
// ******************************************************************************
6371

6472
private final static XMLOutputFactory soutfactory = XMLOutputFactory.newInstance();
6573
private final static XMLInputFactory sinfactory = XMLInputFactory.newInstance();

test/src/java/org/jdom2/test/cases/output/TestStAXReader2Writer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515

1616
@SuppressWarnings("javadoc")
1717
public class TestStAXReader2Writer extends AbstractTestRoundTrip {
18+
19+
// ******************************************************************************
20+
// ******************************************************************************
21+
// StAX is really ugly - it has broken namespace and comment handling
22+
// As a result, some of these test cases fail
23+
// testComplex - because StAX ignores a Comment content
24+
// testNamespaces - because StAX Can't handle redeclaring default Namespace to ""
25+
// ******************************************************************************
26+
// ******************************************************************************
1827

1928
@Override
2029
Document prepare(Document doc) {

test/src/java/org/jdom2/test/cases/output/TestStAXStreamOutputter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@
5555
@SuppressWarnings("javadoc")
5656
public final class TestStAXStreamOutputter extends AbstractTestOutputter {
5757

58+
// ******************************************************************************
59+
// ******************************************************************************
60+
// StAX is really ugly - it breaks SurrogatePair handling with non-UTF8 encoding
61+
// As a result, some of these test cases fail in Recent Java versions
62+
// - most test*Surrogate*Pair tests.
63+
// ******************************************************************************
64+
// ******************************************************************************
5865

5966
private static final XMLOutputFactory soutfactory = XMLOutputFactory.newInstance();
6067
private static final XMLInputFactory sinfactory = XMLInputFactory.newInstance();

0 commit comments

Comments
 (0)