ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjiva Weerawarana" <sanj...@watson.ibm.com>
Subject Re: NullPointerException when serializing null String objects
Date Thu, 06 Dec 2001 18:49:38 GMT
OK, I understand the problem - the problem is that your MyClassSerializer
isn't following the contract that the built-in StringSerializer expects;
that it will not be invoked for null-valued strings. The way it works
for null valued properties via the bean serializer for example is that
the BeanSerializer checks for null-ness.

The expected contract is poorly documented (the src is the doc :-)), so
I agree this should be treated as a bug .. I'll try to commit a fix
that checks for null-ness to avoid this situation.

Sanjiva.

----- Original Message -----
From: "David Turner" <turner@genome.wi.mit.edu>
To: <soap-dev@xml.apache.org>
Sent: Thursday, December 06, 2001 9:27 PM
Subject: Re: NullPointerException when serializing null String objects


> Hi everyone,
>
> The "NullPointerException" occurs when there's a null String object that's
part
> of the composition of another class.
> For instance, I have a class called "MyClass" that contains two private
> members: a String object and a URL object.  If I leave the String object
inside
> of "MyClass" null this is when the exception takes place.  Passing a null
> String object by itself works.
>
> I apologize if I didn't fully explain this correctly in my original email.
>
> I'm enclosing the client code & any supporting code for this test.
>
> David
>
>
>
>
>
> Sanjiva Weerawarana wrote:
>
> > No, that code was not the problem code- that was just a serializer
> > he wrote. THe point is that the string serializer (cleanSer in
> > SOAPMappingRegistry) is not invoked directly; its invoked via
> > ParameterSerializer which handles the null.
> >
> > I'd still like to see what Apache SOAP 2.2 client code he wrote
> > that caused the null strings to break.
> >
> > Sanjiva.
> >
> > ----- Original Message -----
> > From: "Brian Gilman" <gilmanb@genome.wi.mit.edu>
> > To: <soap-dev@xml.apache.org>
> > Sent: Thursday, December 06, 2001 8:30 PM
> > Subject: Re: NullPointerException when serializing null String objects
> >
> > > Hello all,
> > >
> > > I believe Dave already forwarded the code to this list. Please
> > > take a look at this thread to find it.
> > >
> > > Best,
> > >
> > > -B
> > >
> > > -----------------------
> > > Brian Gilman <gilmanb@genome.wi.mit.edu>
> > > Sr. Software Engineer MIT/Whitehead Inst. Center for Genome Research
> > > One Kendall Square, Bldg. 300 / Cambridge, MA 02139-1561 USA
> > > phone +1 617  252 1069 / fax +1 617 252 1902
> > >
> > >
> > > On Thu, 6 Dec 2001, Sanjiva Weerawarana wrote:
> > >
> > > > How did you serialize the string? If its a parameter to an RPC
> > > > call the null value should be handled correctly.
> > > >
> > > > Can you post the code that shows the problem please?
> > > >
> > > > Sanjiva.
> > > >
> > > > ----- Original Message -----
> > > > From: "David Turner" <turner@genome.wi.mit.edu>
> > > > To: <soap-dev@xml.apache.org>
> > > > Sent: Wednesday, December 05, 2001 10:36 PM
> > > > Subject: NullPointerException when serializing null String objects
> > > >
> > > >
> > > > >
> > > > > I ran into a problem with SOAP's current String serialization when
it
> > > > > encounters null String objects.   I couldn't find anything in
either
> > the
> > > > > user or dev archives regarding this so I don't know if this is a
bug
> > or
> > > > > not.
> > > > >
> > > > > I ended up writing my own String serializer which handled the null
> > > > > situation.  I only used my String serializer on the client side
when
> > > > > sending data to the service -- the soap service just uses the
default
> > > > > soap String serializer/deseralizer.   I have attached the source
code
> > > > > for my String serializer in case it can be incorporated into SOAP.
> > > > >
> > > > > What I would like to know is if this is currently an issue or not?
> > Is
> > > > > SOAP currently able to handle null String objects during
serializing?
> > > > >
> > > > > Much appreciated.
> > > > >
> > > > > David
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > I
> > > > >
> > > > >
> > > > >
> > > >
> > > >
>
> --
> David Turner <turner@genome.wi.mit.edu>
> Senior Software Engineer
> Whitehead Institute/MIT Center for Genome Research
> One Kendall Square, Bldg. 300
> Cambridge, MA 02139-1561 USA
> phone 617-252-1573 / fax 617-252-1902
>
>


----------------------------------------------------------------------------
----


> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
>              id="urn:EchoService">
>   <isd:provider type="java"
>                 scope="Application"
>                 methods="echoString echoURL echoClass echoXMLString">
>     <isd:java class="dt.soap.EchoService.EchoService" static="false"/>
>   </isd:provider>
>
>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListene
r>
>
>   <isd:mappings>
>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:x="http://omnigene.org/xsd" qname="x:URL"
>      javaType="java.net.URL"
>      java2XMLClassName="dt.soap.EchoService.URLSerializer"
>              xml2JavaClassName="dt.soap.EchoService.URLDeserializer"/>
>
> <!--
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:x="http://omnigene.org/xsd" qname="x:String"
>      javaType="java.lang.String"
>              xml2JavaClassName="dt.soap.EchoService.StringDeserializer"/>
>
> #####      java2XMLClassName="dt.soap.EchoService.StringSerializer"
> -->
>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:x="http://omnigene.org/xsd" qname="x:MyClass"
>      javaType="dt.soap.EchoService.MyClass"
>      java2XMLClassName="dt.soap.EchoService.MyClassSerializer"
>              xml2JavaClassName="dt.soap.EchoService.MyClassDeserializer"/>
>
>   </isd:mappings>
>
>
> </isd:service>
>
>
>


Mime
View raw message