Original author: jellefre...@gmail.com (November 02, 2011 16:43:18)
What steps will reproduce the problem?
What is the expected output?
Serialization without errors/exceptions.
What do you see instead?
A NotSerializableException is thrown.
Please provide any additional information below.
A StateVertix contains a variable candidateActionsSearchLock, which is an Object to guard a critical section in the method searchForCandidateElements(), but an Object is not Serializable.
Making the variable transient doesn't solve the problem, because during deserialization the variable would be set to the default value (null for objects), which leads to a NullPointerException when Java subsequently tries to acquire the lock for the critical section.
Removing the variable and synchronizing the critical section on this instead of that variable probably works, but may lead to incorrect behavior if any other piece of code uses a StateVertix as a guard for a critical section.
Changing the variable to a String and setting it to an empty String will work. It does not suffer from the problems of solution 1 and 2, only has a small memory footprint and doesn't require any extra lines of code.
Original issue: http://code.google.com/p/crawljax/issues/detail?id=53
fixes issues #52 and #53, resolved typo in StateVertix -> StateVertex.