Android Hashtable Serialization
Posted
by Nsyed
on Stack Overflow
See other posts from Stack Overflow
or by Nsyed
Published on 2010-04-13T17:21:26Z
Indexed on
2010/04/13
17:22 UTC
Read the original article
Hit count: 385
Hi All,
I am having a weird issue with serialization of a Hashtable. I have made a Server, Client app. Where server(PC/MAC) is serializing a Hashtable and sending it to Client(Android) through UDP. The data is sent/read correctly but I get a bunch of these messages below on LogCat.
04-12 11:19:43.059: DEBUG/dalvikvm(407): GetFieldID: unable to find field Ljava/util/Hashtable;.loadFactor:F
Occasionally, I would see these
04-12 11:21:19.150: DEBUG/dalvikvm(407): GC freed 10814 objects / 447184 bytes in 97ms
The app would run for 2-3 mins and then crash. Interestingly enough I do not see the Loadfactor errors on SDK 1.5. But I do see the GC Free xxxx objects, quiet often.
After debugging I have found that the issue is with de-serialization and the error/warning are coming from following code
Code:
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
object = ois.readObject();
at Code: object = ois.readObject();
on the client. My server is serializing code is the following.
Code:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
Any idea what is going on?
Thanks for the Help!
© Stack Overflow or respective owner