FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux wh58-307 2.6.16.18 #1 SMP PREEMPT Tue May 30 20:43:33 MEST 2006 i686 athlon i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When reading a valid xml file using SUNs StAX implementation, I always get an StackOverflowError probably because the internal xerces implementation is bogus.
My guess is, that it does not handle element text correctly.
A short application, that demonstrates the error, might be downloaded via
http://www.linofee.org/~jel/develop/sunStax/ :
Bla.java .. the mini demo application
US.xml.gz .. the xml file to parse
exception.txt.gz .. full exception
Reading the file with Bea/Codehaus StAX RI is no problem at all.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java -cp . Bla US.xml.gz
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exceptions at all
ACTUAL -
GetAttributesCSResponse
Timestamp: 2006-06-17T00:10:30.477Z
Ack: Success
Version: 465
Build: e465_core_Bundled_3077069_R1
AttributeSystemVersion: 2922
AttributeData: Exception in thread "main" java.lang.StackOverflowError
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanName(XMLEntityScanner.java:726)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1835)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3018)
...
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
...
XMLStreamReader in = ....;
...
String txt = in.getElementText();
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
XMLInputFactory xif = XMLInputFactory.newInstance();
// bad for performance
xif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);