JDK-6440214 : StackOverflowError by xerces..FragmentContentDriver.next when coalescing is TRUE
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxp
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • CPU: x86
  • Submitted: 2006-06-19
  • Updated: 2016-10-13
  • Resolved: 2016-10-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Relates :  
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
No longer an issue. The provided test passed against 6u27, 7.0, 8.0 and 9.
13-10-2016

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.
26-07-2006

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