NPE on complex elements with default or fixed values
----------------------------------------------------

                 Key: XMLBEANS-316
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-316
             Project: XMLBeans
          Issue Type: Bug
    Affects Versions: Version 2.1, Version 2.2, Version 2.2.1
         Environment: Sun Java 6 (build 1.6.0-b105), Linux
            Reporter: Benjamin Gufler


Compiling an XML schema which defines default or fixed values for elements with 
complex types leads to a NPE in StscChecker:
Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.xmlbeans.impl.schema.StscChecker.checkElementDefaults(StscChecker.java:206)
        at 
org.apache.xmlbeans.impl.schema.StscChecker.checkFields(StscChecker.java:152)
        at 
org.apache.xmlbeans.impl.schema.StscChecker.checkAll(StscChecker.java:67)
        at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compileImpl(SchemaTypeSystemCompiler.java:310)
        at 
org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:181)
        at 
org.apache.xmlbeans.impl.tool.SchemaCompiler.loadTypeSystem(SchemaCompiler.java:952)
        at 
org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:1072)
        at 
org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:368)
(The line numbers in this stack trace refer to xmlbeans-2.2.0, but the same 
error arises with 2.1.0).

Here's a minimal subset of the schema I'd like to compile which reproduces the 
error:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xs:element name="Segment" type="Spectrum" />
        <xs:complexType name="Spectrum">
                <xs:sequence>
                        <xs:element minOccurs="0" maxOccurs="1" 
name="SegmentType" type="TextParam" default="Spectrum" />
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="TextParam" mixed="true">
                <xs:attribute name="name" type="xs:string">
                </xs:attribute>
                <xs:attribute name="ucd" type="xs:string">
                </xs:attribute>
        </xs:complexType>
</xs:schema>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to