You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Benjamin Gufler (JIRA)" <xm...@xml.apache.org> on 2007/02/28 16:09:57 UTC

[jira] Created: (XMLBEANS-316) NPE on complex elements with default or fixed values

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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Issue Comment Edited: (XMLBEANS-316) NPE on complex elements with default or fixed values

Posted by "Vladimir Shor (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780542#action_12780542 ] 

Vladimir Shor edited comment on XMLBEANS-316 at 11/20/09 2:32 PM:
------------------------------------------------------------------

XMLBeans 2.4.0 also have this bug. 

Looking at the source I would rather say that the bug occurs if complexType element has mixed=true and it has only attributes. Then this line in (org.apache.xmlbeans.impl.schema.StscChecker:254 in the trunk currently@20.nov.2009):

if (!model.getType().getContentModel().isSkippable())

throws NPE. I Guess ContentModel is not set, if element has nothing besides attributes.


      was (Author: vovencij):
    XMLBeans 2.4.0 also have this bug.
  
> 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
>            Assignee: Radu Preotiuc-Pietro
>
> 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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Assigned: (XMLBEANS-316) NPE on complex elements with default or fixed values

Posted by "Cezar Andrei (JIRA)" <xm...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLBEANS-316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cezar Andrei reassigned XMLBEANS-316:
-------------------------------------

    Assignee: Radu Preotiuc-Pietro

Exception in thread "main" java.lang.NullPointerException
        at org.apache.xmlbeans.impl.schema.StscChecker.checkElementDefaults(StscChecker.java:255)
        at org.apache.xmlbeans.impl.schema.StscChecker.checkFields(StscChecker.java:192)
        at org.apache.xmlbeans.impl.schema.StscChecker.checkAll(StscChecker.java:68)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compileImpl(SchemaTypeSystemCompiler.java:311)
        at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:181)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.loadTypeSystem(SchemaCompiler.java:979)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:1100)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:373)

> 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
>            Assignee: Radu Preotiuc-Pietro
>
> 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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Issue Comment Edited: (XMLBEANS-316) NPE on complex elements with default or fixed values

Posted by "Vladimir Shor (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780542#action_12780542 ] 

Vladimir Shor edited comment on XMLBEANS-316 at 11/20/09 2:33 PM:
------------------------------------------------------------------

XMLBeans 2.4.0 also have this bug. 

Looking at the source I would rather say that the bug occurs if complexType element has mixed=true and it has only attributes. Then this line in (org.apache.xmlbeans.impl.schema.StscChecker:254 in the trunk currently, 20.nov.2009):

if (!model.getType().getContentModel().isSkippable())

throws NPE. I Guess ContentModel is not set, if element has nothing besides attributes.


      was (Author: vovencij):
    XMLBeans 2.4.0 also have this bug. 

Looking at the source I would rather say that the bug occurs if complexType element has mixed=true and it has only attributes. Then this line in (org.apache.xmlbeans.impl.schema.StscChecker:254 in the trunk currently@20.nov.2009):

if (!model.getType().getContentModel().isSkippable())

throws NPE. I Guess ContentModel is not set, if element has nothing besides attributes.

  
> 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
>            Assignee: Radu Preotiuc-Pietro
>
> 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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Commented: (XMLBEANS-316) NPE on complex elements with default or fixed values

Posted by "Vladimir Shor (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780542#action_12780542 ] 

Vladimir Shor commented on XMLBEANS-316:
----------------------------------------

XMLBeans 2.4.0 also have this bug.

> 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
>            Assignee: Radu Preotiuc-Pietro
>
> 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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org