Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-1148

Anonymous Simple Type causes NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jbossws-1.0.4
    • jbossws-1.0.2
    • jbossws-native
    • None

      There is a problem with the marshalling of their web service response message 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.

      java.lang.NullPointerException
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalSimpleType(MarshallerImpl.java:458)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementType(MarshallerImpl.java:415)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElement(MarshallerImpl.java:331)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementOccurence(MarshallerImpl.java:311)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(MarshallerImpl.java:730)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroupSequence(MarshallerImpl.java:920)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroup(MarshallerImpl.java:860)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(MarshallerImpl.java:641)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalComplexType(MarshallerImpl.java:608)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementType(MarshallerImpl.java:419)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElement(MarshallerImpl.java:331)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementOccurence(MarshallerImpl.java:311)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshallInternal(MarshallerImpl.java:210)
      at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshal(MarshallerImpl.java:168)
      at org.jboss.ws.jaxb.JBossXBMarshallerImpl.marshal(JBossXBMarshallerImpl.java:146)
      at org.jboss.ws.jaxrpc.encoding.JAXBSerializer.serialize(JAXBSerializer.java:107)

      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.

            darran.lofthouse@redhat.com Darran Lofthouse
            darran.lofthouse@redhat.com Darran Lofthouse
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: