Octavian Nadolu created XERCESJ-1605:
----------------------------------------

             Summary: NPE when comparing alternative types
                 Key: XERCESJ-1605
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1605
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.1 Structures
    Affects Versions: 2.11.0
            Reporter: Octavian Nadolu
            Priority: Minor


When I validate the following schema I get an NPE. It seems that one of the 
default alternative types is null. The schema is bigger but I extracted only a 
part of it, just to reproduce the problem.
I tested on the xml-schema-1.1-dev branch. 

---- schema.xsd------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
    <xsd:complexType name="type1">
        <xsd:choice>
            <xsd:sequence>
                <xsd:element name="Element1">
                    <xsd:alternative test="@index='3'" type="TypeI3"/>
                    <xsd:alternative type="TypeI5"/>
                </xsd:element>
            </xsd:sequence>
            <xsd:sequence>
                <xsd:element name="Element1">
                    <xsd:alternative test="@index='3'" type="TypeI3"/>
                    <xsd:alternative type="TypeI5"/>
                    <xsd:unique name="TypeI5_U">
                        <xsd:selector xpath="*"/>
                        <xsd:field xpath="@index"/>
                    </xsd:unique>
                </xsd:element>
            </xsd:sequence>
        </xsd:choice>
    </xsd:complexType>
    <xsd:complexType name="TypeI3"/>
    <xsd:complexType name="TypeI5"/>
</xsd:schema>
----------------------------------------------------------

----------- NPE------------------------------
java.lang.NullPointerException
        at 
org.apache.xerces.impl.xs.XS11Constraints.isTypeAlternativesEquivalent(XS11Constraints.java:235)
        at 
org.apache.xerces.impl.xs.XS11Constraints.isTypeTablesEquivalent(XS11Constraints.java:227)
        at 
org.apache.xerces.impl.xs.XS11Constraints.findElemInTable(XS11Constraints.java:137)
        at 
org.apache.xerces.impl.xs.XS11Constraints.checkElementDeclsConsistent(XS11Constraints.java:105)
        at 
org.apache.xerces.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:422)
        at 
org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:618)
        at 
org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
        at 
org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
        at XercesValidation.main(XercesValidation.java:256)
----------------------------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to