[JBoss JIRA] Created: (JBXB-78) NPE marshalling simple anonymous types
by Alexey Loubyansky (JIRA)
NPE marshalling simple anonymous types
--------------------------------------
Key: JBXB-78
URL: http://jira.jboss.com/jira/browse/JBXB-78
Project: JBoss XML Binding (JBossXB)
Issue Type: Bug
Affects Versions: JBossXB-1.0.0.CR6
Reporter: Alexey Loubyansky
Assigned To: Alexey Loubyansky
Fix For: JBossXB-1.0
If a complex type
contains an element which contains an anonymous simple type with
restriction. E.g: -
<complexType name='TelephoneNumber'>
<sequence>
<element name='areaCode' nillable='true'>
<simpleType>
<restriction base='string'>
<pattern value='[0-9]{5}'/>
</restriction>
</simpleType>
</element>
<element name='number' nillable='true' type='string'/>
</sequence>
</complexType>
This causes a NullPointerException because the class MarshallerImpl is
expecting the type to have a QName. The exception is at the bottom of
the e-mail, the attached war can be used to reproduce the problem (use
SoapUI to send the request message).
Looking at the marshalSimpleType method of the MarshallerImpl class the
QName of the type is used to check if it is QName or NOTATION, checking
that the QName is set before using it appears to fix this problem.
Second the method marshalCharacters also makes use of the QName of the
type to check if the namespace of the type is the schema namespace.
For both of these problems checking for null before using the QName
appears to fix the problem and my web service works as expected (I have
attached a patch containing my changes). Could you please let me know
if this is an appropriate fix?
Regards,
Darran Lofthouse.
java.lang.NullPointerException
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalSimpleType
(MarshallerImpl.java:458)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementTyp
e(MarshallerImpl.java:415)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElement(Ma
rshallerImpl.java:331)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementOcc
urence(MarshallerImpl.java:311)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(M
arshallerImpl.java:730)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroup
Sequence(MarshallerImpl.java:920)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroup
(MarshallerImpl.java:860)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(M
arshallerImpl.java:641)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalComplexTyp
e(MarshallerImpl.java:608)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementTyp
e(MarshallerImpl.java:419)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElement(Ma
rshallerImpl.java:331)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementOcc
urence(MarshallerImpl.java:311)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshallInternal(
MarshallerImpl.java:210)
at
org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshal(Marshalle
rImpl.java:168)
at
org.jboss.ws.jaxb.JBossXBMarshallerImpl.marshal(JBossXBMarshallerImpl.ja
va:146)
at
org.jboss.ws.jaxrpc.encoding.JAXBSerializer.serialize(JAXBSerializer.jav
a:107)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
18 years, 2 months