Menu

#18 NullPointerException in SoapSerializationEnvelope

open
nobody
ksoap (16)
5
2005-08-24
2005-08-24
hakkikt
No

readSerializable(XmlPullParser parser,
KvmSerializable obj) throws a NullPointerException
when the namespace of a property of an object is
null. It also contains a trivial (always false) test for
null against info.

if (info.name == null
? testIndex == sourceIndex
: (info.name.equals(name)
&& info == null
||
info.namespace.equals(parser.getNamespace())))
break;

I believe the correct if statement should be

if (info.name == null
? testIndex == sourceIndex
: (info.name.equals(name)
&& info.namespace == null
||
info.namespace.equals(parser.getNamespace())))
break;

Discussion

  • James Seigel

    James Seigel - 2005-12-08

    Logged In: YES
    user_id=1282699

    You can also add an entry for the namespace of the
    PropertyInfo Object you create in your KVMSeriazlizable objects.

    Cheers

     
  • hakkikt

    hakkikt - 2005-12-08

    Logged In: YES
    user_id=1148800

    It's a workaround but the code's still wrong. Info can never be null but
    info.namespace can. I'm providing a valid namespace for my custom
    KvmSerializable objects but I also use some autogenerated SoapObjects and
    they cause the NullPointerException to occur unless I use the fix described.
    From the source it looks like I can use addTemplate to work around this as
    well but once again it's just a workaround for that broken code.

     
  • James Seigel

    James Seigel - 2006-01-24

    Logged In: YES
    user_id=1282699

    Do you have a suggesting for a good fix and a unit test that
    would show/provoke the problem? It would be awesome if you
    had any suggestions and if you could move it over to
    ksoap2.sf.net

    Cheers
    J

     
  • James Seigel

    James Seigel - 2006-02-21

    Logged In: YES
    user_id=1282699

    Bug fixed in the code checked into CVS. Check the ksoap2 project.

    ksoap2.sourceforge.net

    Thanks hakkikt

     

Log in to post a comment.