Update: OK so I\'ve grayed out parts of code and found what was causing the problem. I\'ve added here 3 lines of code with the comment \"this is the added code that causes t
When you output an object using writeObject(Object), the instance will be serialized (as expected). The problem is, the serialized version will be cached, and any time you attempt to write that same instance a second time, the cached version of the serialized instance is referenced.
To avoid this, you can either call reset() after calling writeObject(Object)
, or you could use writeUnshared(Object)