users@jaxb.java.net

Exception when Unmarshalling an element with int list as value.

From: Poccachard, Ian AG <ian.poccachard_at_rolls-royce.com>
Date: Wed, 17 Dec 2003 10:10:06 -0000

Hi Guys...

I am having a spot of bother unmarshalling an instance file
that was created and marshalled using classes generated
from schema that include an xsd:list

schema snippet:
    <!-- derived integer array -->
    <xsd:simpleType name="INTEGER_ARRAY" >
        <xsd:list itemType="xsd:int" />
    </xsd:simpleType>
    
    <xsd:complexType name="IntegerArray">
        <xsd:simpleContent>
            <xsd:extension base="INTEGER_ARRAY">
                <xsd:attributeGroup ref="ElementPI"/>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:element name="integer_array" type="IntegerArray"/>

instance snippet:
    <blahBlah>
        <gks_core:integer_array calculated="false"
                name="\GSN001\Index">1 0 16</gks_core:integer_array>
    </blahBlah>

The stack trace is included at the end of this message.

Tracing the problem through, the IntegerArray class' (generated
by the xjc from the snippet above) Unmarshaller sets the stateTextTypes
variable of its super class (AbstractUnmarshallingEventHandlerImpl)
to a String that is inconsistent with the state that should correspond to
the listState when tested in the super class' isListState() method during
the
unmarshalling of the instance file.

This leads to the String "1 0 16" being parsed as an Integer rather than
being first tokenised thereby leading to the exception.

Question:

Is this a known problem? I did not see this when using 1.0 and before I
begun using namespaces. I have searched the JAXB resources to find
mention of this issue but there is no trace.

Do I need to reproduce this in a simple example for you to find a fix?

Further info:

JAXB 1.02, I've used both xerces and crimson parsers inside and outside
my Netbeans IDE. Note there is type inheritance that crosses namespaces.
My schemas were compiled together at the same time.

Best Regards

Ian



java.lang.NullPointerException
        at
com.sun.xml.bind.DatatypeConverterImpl.parseInt(DatatypeConverterImpl.java:7
6)
        at
javax.xml.bind.DatatypeConverter.parseInt(DatatypeConverter.java:144)
        at
com.rr.gks.core.xmlmap.impl.IntegerArrayPIImpl$Unmarshaller.eatText3(Integer
ArrayPIImpl.java:420)
        at
com.rr.gks.core.xmlmap.impl.IntegerArrayPIImpl$Unmarshaller.handleText(Integ
erArrayPIImpl.java:379)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.te
xt(AbstractUnmarshallingEventHandlerImpl.java:91)
        at
com.rr.gks.core.xmlmap.impl.IntegerArrayElementImpl$Unmarshaller.handleText(
IntegerArrayElementImpl.java:278)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.te
xt(AbstractUnmarshallingEventHandlerImpl.java:91)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.consumeText(S
AXUnmarshallerHandlerImpl.java:216)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.processText(S
AXUnmarshallerHandlerImpl.java:220)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SA
XUnmarshallerHandlerImpl.java:145)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1675)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at
com.rr.gks.core.xmlmap.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerI
mpl.java:142)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshall
erImpl.java:131)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshall
erImpl.java:178)
        at
com.rr.gks.core.xmlloader.XmlSetSupport.run(XmlSetSupport.java:154)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670)
--------------- linked to ------------------
javax.xml.bind.UnmarshalException: Unexpected text "1 0 16"
 - with linked exception:
[java.lang.NullPointerException]
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(S
AXUnmarshallerHandlerImpl.java:551)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.re
portError(AbstractUnmarshallingEventHandlerImpl.java:148)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.ha
ndleUnexpectedTextException(AbstractUnmarshallingEventHandlerImpl.java:130)
        at
com.rr.gks.core.xmlmap.impl.IntegerArrayPIImpl$Unmarshaller.handleText(Integ
erArrayPIImpl.java:410)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.te
xt(AbstractUnmarshallingEventHandlerImpl.java:91)
        at
com.rr.gks.core.xmlmap.impl.IntegerArrayElementImpl$Unmarshaller.handleText(
IntegerArrayElementImpl.java:278)
        at
com.rr.gks.core.xmlmap.impl.runtime.AbstractUnmarshallingEventHandlerImpl.te
xt(AbstractUnmarshallingEventHandlerImpl.java:91)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.consumeText(S
AXUnmarshallerHandlerImpl.java:216)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.processText(S
AXUnmarshallerHandlerImpl.java:220)
        at
com.rr.gks.core.xmlmap.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SA
XUnmarshallerHandlerImpl.java:145)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1675)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
        at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at
com.rr.gks.core.xmlmap.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerI
mpl.java:142)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshall
erImpl.java:131)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshall
erImpl.java:178)
        at
com.rr.gks.core.xmlloader.XmlSetSupport.run(XmlSetSupport.java:154)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670)


The data contained in, or attached to, this e-mail, may contain confidential
information. If you have received it in error you should notify the sender
immediately by reply e-mail, delete the message from your system and contact
+44(0)1332 242424 (the Rolls-Royce IT Security Director) if you need
assistance. Please do not copy it for any purpose, or disclose its contents
to any other person.

An e-mail response to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.

(c) 2003 Rolls-Royce plc

Registered office: 65 Buckingham Gate, London SW1E 6AT
Company number: 1003142. Registered in England.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net