You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by xm...@xml.apache.org on 2004/10/23 04:42:46 UTC

[jira] Resolved: (XMLBEANS-66) NullPointerException when restricting a union with one of the union members

Message:

   The following issue has been resolved as FIXED.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XMLBEANS-66

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XMLBEANS-66
    Summary: NullPointerException when restricting a union with one of the union members
       Type: Bug

     Status: Resolved
   Priority: Major
 Resolution: FIXED

    Project: XMLBeans
 Components: 
             Compiler
   Fix Fors:
             Version 2 Beta 1
   Versions:
             Version 2

   Assignee: Jacob Danner
   Reporter: Kevin Krouse

    Created: Tue, 5 Oct 2004 11:25 AM
    Updated: Fri, 22 Oct 2004 7:42 PM

Description:
Compile the following trimmed down schema from  http://w3.org/TR/xqueryx/#Schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.w3.org/2003/12/XQueryX"
      xmlns="http://www.w3.org/2003/12/XQueryX" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      elementFormDefault="qualified" 
      attributeFormDefault="qualified">

  <!-- Kludge for anySimpleType -->
  <xsd:simpleType name="constantValueType">
    <xsd:union memberTypes="xsd:integer xsd:decimal xsd:string xsd:double"/>
  </xsd:simpleType>

  <!-- constant expressions. We have 4 different subclasses for this -->
  <xsd:complexType name="constantExpr">
        <xsd:sequence>
          <xsd:element name="value" type="constantValueType"/>
        </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="integerConstantExpr">
    <xsd:complexContent>
      <xsd:restriction base="constantExpr">
        <xsd:sequence>
          <xsd:element name="value" type="xsd:integer"/>
        </xsd:sequence>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>

</xsd:schema>



results in:

Exception in thread "main" java.lang.NullPointerException
        at org.apache.xmlbeans.impl.schema.StscChecker.checkAllDerivationsForRestriction(StscChecker.java:1412)
        at org.apache.xmlbeans.impl.schema.StscChecker.typeDerivationOK(StscChecker.java:1394)
        at org.apache.xmlbeans.impl.schema.StscChecker.nameAndTypeOK(StscChecker.java:1337)
        at org.apache.xmlbeans.impl.schema.StscChecker.isParticleValidRestriction(StscChecker.java:404)
        at org.apache.xmlbeans.impl.schema.StscChecker.checkRestriction(StscChecker.java:364)
        at org.apache.xmlbeans.impl.schema.StscChecker.checkAll(StscChecker.java:63)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compileImpl(SchemaTypeSystemCompiler.java:268)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:195)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.loadTypeSystem(SchemaCompiler.java:853)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:911)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:330)



When checkAllDerivationsForRestriction() loops from the derived type down to the base, if the type is a union we continue following one of the types (that is assignable).  What is happening now is the derived type is never reaching the base type since the base type is one of the union members.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org