On 31/05/2013 14:39, Aleksej Efimov wrote:
Obviously, we can't throw the ISE - it's not described in docs for
readObject() method.
Exceptions suggested by Jason have the following descriptions:
InvalidClassException: Something is wrong with a class used by
serialization.
StreamCorruptedException: Control information in the stream is
inconsistent.
I think InvalidClassException more suitable for our case, because we
have here the problem with inconsistent state of serialized class, but
not the control information in the stream (invalid stream header,
invalid type code and etc).
Aleksej
Yes, InvalidClassException would be best.
I see you've added a serialization/deserialization test (thanks) but it
wouldn't have caught this. What would you think about serializing a few
XPathException instances with a jdk7 build and use the byte stream in
the test to check that they are handled correctly. That would give more
confident that there aren't any other holes.
-Alan