Hi, 

I have encountered a NPE issue during compile time with the following
error: 

>scomp -d class_xsb -src src -srconly -mx 500m datamodel.xsd 
Time to build schema type system: 2.657 seconds Exception in thread
"main" java.lang.NullPointerException at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.writeType
Data(SchemaTypeSystemImpl.java:2872) at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveType(SchemaType
SystemImpl.java:1454) at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursivel
y(SchemaTypeSystemImpl.java:1331) at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.saveTypesRecursivel
y(SchemaTypeSystemImpl.java:1332) at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.save(SchemaTypeSyst
emImpl.java:1307) at 
org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java
:1126) at 
org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:37
3) 

The problem happens during a .xsd compile using scomp: after it
generated all the .xsb files and the schema type system generation is
said to have completed, then it failed I think while attempting to
create a "TypeSystemHolder.class". 
 
I was able to pin point the issue to the syntax below ... which seems to
have caused a null SchemaStringEnumEntry[] while trying to writeTypeData
inside SchemaTypeSystemImpl. 

As far as I can tell the syntax seems to be valid, I was able to run it
through a validator and was able to compile it in jaxb.
<xs:element name="XYZType"> 
    <xs:complexType> 
      <xs:simpleContent> 
        <xs:restriction base="xs:anyType"> 
          <xs:simpleType> 
            <xs:retriction base="xs:token"> 
              <xs:enumeration value="abc"/> 
              <xs:enumeration value="def"/> 
              <xs:enumeration value="unknown"/> 
            </xs:restriction> 
          </xs:simpleType> 
          </xs:restriction> 
      </xs:simpleContent> 
    </xs:complexType> 
  </xs:element> 

 
I have also noticed that if I change the above syntax to the following
then it would compile in XMLBeans
<xs:simpleType name = "XYZEnum">
  <xs:retriction base="xs:token"> 
       <xs:enumeration value="abc"/> 
       <xs:enumeration value="def"/> 
       <xs:enumeration value="unknown"/> 
  </xs:restriction> 
</xs:simpleType> 
 
<xs:element name="XYZType"> 
      <xs:complexType> 
        <xs:extension base="event: XYZEnum"> 
      </xs:extension> 
    </xs:complexType> 
  </xs:element> 
 
I believe the two are semantically the same. I don't understand why one
would compile while the other won't. Any suggestion/input would be
greatly appreciated.
 
Thanks, 
Jenny
p.s. I am running the latest 2.3.0 release.  
 

Reply via email to