47 - Java Serialization using ObjectInputValidation - Unit Tests Code Demo 2

@backstreetbrogrammer -------------------------------------------------------------------------------- Chapter 18 - Java Serialization using ObjectInputValidation - Unit Tests Code Demo 2 -------------------------------------------------------------------------------- Suppose we have done the deserialization of a complete object graph, and now we want to validate the invariants of the objects. We can do that by implementing ObjectInputValidation interface and overriding the validateObject() method from it. The method validateObject() will automatically get called when we register this validation by calling () from readObject() method. It is very useful to verify that stream has not been tampered with, or that the data makes sense before handing it back to your application. If the object cannot be made valid, it should throw the InvalidObjectException. Any exception that occurs during a call to validateObject() will termina
Back to Top