[
https://issues.apache.org/jira/browse/XERCESJ-1580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919223#comment-13919223
]
Octavian Nadolu commented on XERCESJ-1580:
------------------------------------------
One of the Oxygen users reported a similar problem, but this time with a
smaller values for the maxOccurs attribute.
If I validate the "instance.xml" file against the "oomValidation.xsd" schema, I
get an OutOfMemoryError exception.
{code:xml|title=instance.xml}
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="oomValidation.xsd">
</root>
{code}
{code:xml|title=oomValidation.xsd}
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="elemType"/>
<xs:complexType name="elemType">
<xs:sequence minOccurs="1" maxOccurs="254">
<xs:element name="Name" type="xs:string"/>
<xs:element name="Steps" type="xs:string" minOccurs="1"
maxOccurs="254"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
{code}
{code}
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at
org.apache.xerces.impl.dtd.models.CMStateSet.<init>(CMStateSet.java:62)
at org.apache.xerces.impl.xs.models.XSDFACM.buildDFA(XSDFACM.java:608)
at org.apache.xerces.impl.xs.models.XSDFACM.<init>(XSDFACM.java:219)
at
org.apache.xerces.impl.xs.models.CMBuilder.createDFACM(CMBuilder.java:183)
at
org.apache.xerces.impl.xs.models.CMBuilder.getContentModel(CMBuilder.java:123)
at
org.apache.xerces.impl.xs.models.CMBuilder.getContentModel(CMBuilder.java:89)
at
org.apache.xerces.impl.xs.XSComplexTypeDecl.getContentModel(XSComplexTypeDecl.java:208)
at
org.apache.xerces.impl.xs.XSComplexTypeDecl.getContentModel(XSComplexTypeDecl.java:192)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1749)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:380)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:890)
at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:813)
at
org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:186)
at
org.apache.xerces.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:133)
at javax.xml.validation.Validator.validate(Validator.java:127)
{code}
> Out of memory while validating an XML instance with a schema that contains
> particles with a large maxOccurs
> -----------------------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1580
> URL: https://issues.apache.org/jira/browse/XERCESJ-1580
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.1 Structures
> Reporter: Octavian Nadolu
> Priority: Critical
>
> I obtain an OutOfMemory exception when i validate the XML instance "test.xml"
> with the schema "test.xsd".
> You can reproduce the issue on the xml-schema-1.1-dev branch, using the
> jaxp.SourceValidator as follows:
> jaxp.SourceValidator -xsd11 -a test.xsd -i test.xml
> Please note that this exception occurs only if the "full schema checking"
> feature is disabled.
> XML instance: test.xml
> <doc>
> <a/>
> <b/>
> </doc>
> Schema: test.xsd
> <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
> <xsd:complexType name='fooType' >
> <xsd:choice maxOccurs="100000">
> <xsd:sequence maxOccurs="100000000">
> <xsd:element name='a'
> maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:element name="b"/>
> </xsd:choice>
> </xsd:complexType>
> <xsd:element name="doc" type="fooType"/>
> </xsd:schema>
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]