-
Bug
-
Resolution: Fixed
-
P1
-
1.0, 1.2.1
-
1.2.2
-
generic
-
generic, solaris_8
Name: eaR10174 Date: 06/27/2002
An array of Objects usage as
a value of the property 'http://java.sun.com/xml/jaxp/properties/schemaSource' causes
StackOverflowError to be thrown (see test.java below). Everything is okey when the
type of the value is either String or InputStream or InputSource or File.
The bug is found in the patched version of Xerces 2.0.2 release and affects the JAXP
1.2 TCK's TestRun which runs the XMLSchema tests.
------------------- test.java ----------------------------------
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import org.xml.sax.helpers.DefaultHandler;
import java.io.File;
public class test {
public static void main (String[] args) {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser sp = spf.newSAXParser();
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
Object[] schemas = new Object[] {new File("test.xsd")};
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
schemas);
DefaultHandler dh = new DefaultHandler();
sp.parse(new File("test.xml"), dh);
System.out.println("OK");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
----------------------------------------------------------------
------------------- test.xsd ----------------------------------
<?xml version="1.0"?>
<xsd:schema
xmlns="name"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="name">
<xsd:element name="test" type="Test" />
<xsd:complexType name="Test">
<xsd:sequence>
<xsd:element name="abc" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
----------------------------------------------------------------
------------------- test.xml ----------------------------------
<?xml version="1.0"?>
<t:test
xmlns:t="name"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="name test.xsd"
><abc>1</abc></t:test>
----------------------------------------------------------------
------------------ test run result -----------------------------
% java test
Exception in thread "main" java.lang.StackOverflowError
at java.lang.String.<init>(String.java:460)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:64)
at java.io.FileInputStream.<init>(FileInputStream.java:95)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.xsdToXMLInputSource(XMLSchemaLoader.java:647
)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java
:598
)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java
:607
)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489)
at
org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java
:607
)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489)
----------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4722461 [Blocking] StackOverflowException when using JAXP 1.2/Xerces schema functionnali
-
- Closed
-