Re: Data duplication during serialization

2011-09-15 Thread Thomas Broyer
Have a look at http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/client/rpc/core/java/util/HashMap_CustomFieldSerializer.java (and http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/client/rpc/core/java/util/Map

Re: Data duplication during serialization

2011-09-15 Thread Maverick
Thank to both of you for your quick reply. The CustomMap implementation posted here is just a small test case that reproduces the problem, so I'm aware there are a lot of things missing. Although, for the use we are using, duplicating a key due to multiple put() is acceptable. The solution of mak

Re: Data duplication during serialization

2011-09-15 Thread Paul Robinson
Your implementation doesn't handle the case where adding a value to the map overwrites an existing entry. In that case, you shouldn't add a new entry to your list of keys, but replace one of them. When the map is transferred over RPC, the key list is sent with the data. When RPC reconstitutes

Re: Data duplication during serialization

2011-09-15 Thread Thomas Broyer
I think GWT-RPC uses the CustomSerializer for the HashMap (which calls put() for each key/value pair) in addition to deserializing the ArrayList. The custom-serializer will then call your put() methods which will add to the list. Marking the ArrayList 'transient' or @GwtTransient should be enoug

Data duplication during serialization

2011-09-15 Thread Maverick
I'm having a strange behavior (at least, something that I don't understand) during derialization/deserialization, which causes values to be duplicated to a List. I have a custom Map that basically adds key order preserving through an ArrayList. Each time a key/value pair is put into the map, the