3 mistakes you can make when implementing Externalizable

The JDK’s java.io.Externalizable interface is simple to implement. Just 2 methods to implement and you are ready to go. Unfortunately there are a few ways you can shoot yourself in the foot. In this post we look at 3 ways you can make mistakes when implementing Externalizable the readExternal() and writeExternal() methods. This page provides a minimal code snippet to illustrate each mistake.

The first mistake is trivial and it will result in an exception being thrown at runtime.  The second and third types of mistake are more dangerous!  There will be no problem at runtime but the state of the deserialized objects will be incorrect! Not only are you losing information! You may not even notice it. (more…)

Continue Reading
  • 1
  • 2
Close Menu