Hi

I've stumbled over a bit of an oddity with Xstream across these two versions
of Android.

If you have an annotated field:

@XStreamImplicit
public ArrayList<String> myMessages = new ArrayList<String>();

and you read XML using Xstream.fromXML(string);

and test to see if your field has been populated:

if ( myMessages.size()>0 ) {#dostuff


On 4.1 it will work, but 4.3 it will barf with an NPE. In other words, when
reading the XML on 4.1 it seems to leave any fields alone that are not
represented in the XML, whereas on 4.3 it seems to assign null to them.

I've got around the problem by

if ( myMessages != null && myMessages.size()>0 )

but I'd have expected it to be consistent.


Regards,


Charles.

 


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

    http://xircles.codehaus.org/manage_email


Reply via email to