NullPointerException with hexBinary attribute
---------------------------------------------

                 Key: XFIRE-887
                 URL: http://jira.codehaus.org/browse/XFIRE-887
             Project: XFire
          Issue Type: Bug
          Components: Aegis Module
    Affects Versions: 1.2.4
         Environment: Java 1.5, JAXB 2.0.4
            Reporter: Matthew
         Assigned To: Dan Diephouse
            Priority: Blocker


I used wsgen to create a client proxy (jaxb 2.0).  I sent a message that 
contained an object with a null value for an attribute. The attribute is 
defined as

<xsd:attribute name="info" use="optional">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:hexBinary"/>
                    </xsd:simpleType>
                </xsd:attribute>

It fails.  There is no test for null before it tries to marshall the attribute 
value.  

Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not 
invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could 
not marshall type.
org.codehaus.xfire.fault.XFireFault: Could not marshall type.
    at org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:258)
    at 
org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:206)
    at 
org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
    at 
org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:89)
    at 
org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)
    at 
org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
    at 
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.getByteArrayRequestEntity(CommonsHttpMessageSender.java:382)
    at 
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:320)
    at 
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at 
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at 
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
    at org.codehaus.xfire.client.Client.invoke(Client.java:335)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy30.release(Unknown Source)
    at sampleapps.SvcClient.ClientApp.release(ClientApp.java:146)
    at sampleapps.SvcClient.ClientApp.go(ClientApp.java:66)
    at sampleapps.SvcClient.ClientApp.main(ClientApp.java:152)
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.xml.bind.api.AccessorException: java.lang.NullPointerException]
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:295)
    at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:148)
    at org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:253)
    ... 19 more
Caused by: com.sun.xml.bind.api.AccessorException: 
java.lang.NullPointerException
    at 
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:223)
    at 
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:238)
    at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeAttributes(ClassBeanInfoImpl.java:302)
    at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:617)
    at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:93)
    at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:127)
    at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:244)
    at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:251)
    at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:33)
    at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:461)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:292)
    ... 21 more
Caused by: com.sun.xml.bind.api.AccessorException: 
java.lang.NullPointerException
    at 
com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:33)
    at 
com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.print(TransducedAccessor.java:199)
    at 
com.sun.xml.bind.v2.runtime.property.AttributeProperty.serializeAttributes(AttributeProperty.java:61)
    at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeAttributes(ClassBeanInfoImpl.java:295)
    ... 29 more
Caused by: java.lang.NullPointerException
    at 
com.sun.xml.bind.DatatypeConverterImpl.printHexBinary(DatatypeConverterImpl.java:382)
    at 
javax.xml.bind.DatatypeConverter.printHexBinary(DatatypeConverter.java:560)
    at 
javax.xml.bind.annotation.adapters.HexBinaryAdapter.marshal(HexBinaryAdapter.java:25)
    at 
javax.xml.bind.annotation.adapters.HexBinaryAdapter.marshal(HexBinaryAdapter.java:19)
    at 
com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:31)
    ... 32 more

This is a blocker for clients of my application because typically this 
attribute is not supplied.  The schema is from an ECMA standard and I can't 
change the data type.  This particular object is sent on pretty much every call 
to my web service.






-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to