You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Jacob Danner (JIRA)" <xm...@xml.apache.org> on 2005/04/19 23:24:38 UTC
[jira] Closed: (XMLBEANS-9) Null Pointer Exception on enumeration
[ http://issues.apache.org/jira/browse/XMLBEANS-9?page=all ]
Jacob Danner closed XMLBEANS-9:
-------------------------------
Assign To: (was: xmlbeans-dev@xml.apache.org)
Fix Verified, no longer NPE, In V2 error code is:
error: cvc-enumeration-valid: string value
'one' is not a valid enumeration value for enumRefType
> Null Pointer Exception on enumeration
> -------------------------------------
>
> Key: XMLBEANS-9
> URL: http://issues.apache.org/jira/browse/XMLBEANS-9
> Project: XMLBeans
> Type: Bug
> Components: Validator
> Versions: unspecified
> Environment: Operating System: Windows NT/2K
> Platform: PC
> Reporter: Toby H Ferguson
> Attachments: NPE.jar
>
> Using the validator in v1 I get a null pointer exception when I attempt to
> validate an XML instance document against a schema.
> I list the terminal session and the contents of the schema (schema.xsd) and the
> instance document (valid.xml) in that order below. Each section starts with +++
> +++ terminal session
> bash$ validate schema.xsd valid.xml
> java.lang.NullPointerException
> at
> org.apache.xmlbeans.impl.schema.SchemaTypeImpl.ensureStringEnumInfo(SchemaTypeImpl.java:1354)
> at
> org.apache.xmlbeans.impl.schema.SchemaTypeImpl.enumForString(SchemaTypeImpl.java:1289)
> at
> org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx.validateLexical(JavaStringEnumerationHolderEx.java:91)
> at
> org.apache.xmlbeans.impl.validator.Validator.validateAtomicType(Validator.java:1050)
> at
> org.apache.xmlbeans.impl.validator.Validator.validateSimpleType(Validator.java:1020)
> at
> org.apache.xmlbeans.impl.validator.Validator.validateSimpleType(Validator.java:975)
> at org.apache.xmlbeans.impl.validator.Validator.handleText(Validator.java:744)
> at org.apache.xmlbeans.impl.validator.Validator.textEvent(Validator.java:729)
> at org.apache.xmlbeans.impl.validator.Validator.nextEvent(Validator.java:226)
> at org.apache.xmlbeans.impl.store.Saver$ValidatorSaver.emitEvent(Saver.java:3803)
> at org.apache.xmlbeans.impl.store.Saver$ValidatorSaver.emitEvent(Saver.java:3774)
> at
> org.apache.xmlbeans.impl.store.Saver$ValidatorSaver.emitContainer(Saver.java:3753)
> at org.apache.xmlbeans.impl.store.Saver.processContainer(Saver.java:818)
> at org.apache.xmlbeans.impl.store.Saver.process(Saver.java:561)
> at org.apache.xmlbeans.impl.store.Saver$ValidatorSaver.<init>(Saver.java:3592)
> at org.apache.xmlbeans.impl.store.Type.validate(Type.java:321)
> at org.apache.xmlbeans.impl.values.XmlObjectBase.validate(XmlObjectBase.java:351)
> at org.apache.xmlbeans.impl.tool.InstanceValidator.main(InstanceValidator.java:171)
> Exception in thread "main" bash$
> +++ Contents of schema.xsd
> <?xml version = "1.0" encoding = "UTF-8"?>
> <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
> <xsd:element name="doc">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element ref="defns" minOccurs="1" maxOccurs="1"/>
> <xsd:element ref="refs" minOccurs="1" maxOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:key name="enumKeys">
> <xsd:selector xpath=".//defns/enumDef"/>
> <xsd:field xpath="@key"/>
> </xsd:key>
> <xsd:keyref name="enumKeyRef" refer="enumKeys">
> <xsd:selector xpath="./refs/enumRef"/>
> <xsd:field xpath="."/>
> </xsd:keyref>
> </xsd:element>
> <xsd:element name="defns" type="defnsType"/>
> <xsd:element name="enumDef" type="enumDefType"/>
> <xsd:element name="refs" type="refsType"/>
> <xsd:element name="enumRef" type="enumRefType"/>
>
> <xsd:complexType name="defnsType">
> <xsd:sequence>
> <xsd:element ref="enumDef"/>
> </xsd:sequence>
> </xsd:complexType>
>
>
> <xsd:complexType name="enumDefType">
> <xsd:simpleContent>
> <xsd:extension base="enumType">
> <xsd:attribute name="key" type="xsd:string"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
>
> <xsd:simpleType name="enumRefType">
> <xsd:restriction base="enumType"/>
> </xsd:simpleType>
>
> <xsd:simpleType name="enumType">
> <xsd:restriction base="xsd:token">
> <xsd:enumeration value="enum1"/>
> <xsd:enumeration value="enum2"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> <xsd:complexType name="refsType">
> <xsd:sequence>
> <xsd:element ref="enumRef"/>
> </xsd:sequence>
> </xsd:complexType>
>
> </xsd:schema>
> +++ contents of valid.xml
> <?xml version="1.0"?>
> <doc>
> <defns>
> <enumDef key="one">enum1</enumDef>
> </defns>
> <refs>
> <enumRef>one</enumRef>
> </refs>
> </doc>
--
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
-
For more information on JIRA, 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