Closed cesarb closed 7 years ago
Thanks for your report and testcase. writeReplace has many edge cases .. I'll check a soon I find time.
if wrtie replace returns a class which requires a registered serializer writeReplacement fails as there is missing a second lookup for registered serializers in after calling writeReplace.
fixed with 2.52
+1
I encountered an issue serializing a data structure which happened to contain a
LinkedTreeMap
from Gson.LinkedTreeMap
is aMap
with the followingwriteReplace
method:The
LinkedHashMap
returned by that method is not serialized correctly; neither itswriteObject
method norFSTMapSerializer
is called, resulting in corrupted output.The following testcase reproduces the issue. In the testcase, the deserialized
Map
is empty, while it should have one entry. I have also seen anArrayIndexOutOfBoundsException
, or even it trying to load a class with a corrupted name, probably because the structure of the serialized data does not match what the deserializer expects for aLinkedHashMap
.