Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.11.0
-
None
Description
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)
----------------------------------------------------