United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6440214 : StackOverflowError by xerces..FragmentContentDriver.next when coalescing is TRUE

Details
Type:
Bug
Submit Date:
2006-06-19
Status:
Open
Updated Date:
2014-03-04
Project Name:
JDK
Resolved Date:
Component:
xml
OS:
linux
Sub-Component:
jaxp
CPU:
x86
Priority:
P3
Resolution:
Unresolved
Affected Versions:
6
Targeted Versions:
9

Related Reports
Relates:

Sub Tasks

Description
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);

                                    

Comments
EVALUATION

deep within the Xerces scanner, recursion occurs under certain circumstances.  the provided test file with coalescing = true causes massive recursion.  this is a core design of the Xerces scanner and requires significant re-factoring.  this re-factoring is too risky for the Mustang timeframe so CR is being targeted for jaxp.next.
                                     
2006-07-26
EVALUATION

bug is reproducible and is being accepted.
                                     
2006-06-20



Hardware and Software, Engineered to Work Together