[ 
https://issues.apache.org/jira/browse/XERCESJ-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414868#comment-13414868
 ] 

Radu Coravu commented on XERCESJ-1570:
--------------------------------------

I think that the error appears because the XML Schema is parsed as 1.1 but then 
the XML is validated with it as if it was an 1.0 schema.
If you cannot reproduce it, it's OK. You can close it and when we'll update the 
tested Xerces I will post a new bug if it is still encountered.

                
> Stack overflow when validating XML with XML Schema (using 1.1)
> --------------------------------------------------------------
>
>                 Key: XERCESJ-1570
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1570
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Datatypes
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The XML is like:
> <?xml version="1.0" encoding="UTF-8"?>
> <personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      xsi:noNamespaceSchemaLocation="personal.xsd">
>     <person  xsi:type="testType"></person>
> </personnel>
> The XML Schema is like:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>     <xs:complexType name="testType"/>
>     <xs:element name="personnel">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element ref="person" minOccurs="1" maxOccurs="unbounded"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
>     <xs:complexType name="fidji">
>         <xs:attribute name="attr"/>
>     </xs:complexType>
>     <xs:element name="person" type="fidji"/>    
> </xs:schema>
> The schema is parsed as an XML Schema 1.1 and then used to validate the XML.
> The stack overflow is like:
> java.lang.StackOverflowError
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:216)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
>       at 
> org.apache.xerces.impl.xs.XSConstraints.checkComplexDerivation(XSConstraints.java:241)
> at 
> org.apache.xerces.impl.xs.XSConstraints.checkTypeDerivationOk(XSConstraints.java:118)
>       at 
> org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.getAndCheckXsiType(XMLSchemaValidatorXerces.java:2959)
>       at 
> org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.handleStartElement(XMLSchemaValidatorXerces.java:2252)
>       at 
> org.apache.xerces.impl.xs.XMLSchemaValidatorXerces.startElement(XMLSchemaValidatorXerces.java:815)
>       at 
> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:87)
>       at 
> org.apache.xerces.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:963)
>       at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:268)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1655)
> I added some logging in XSConstraints, it has some recursive code like:
>  if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
>             return checkComplexDerivation((XSComplexTypeDecl)directBase, 
> base, block);
> which could be guarded to be something like:
> if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE 
>             && directBase != derived
>             )

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to