title: Upgrading a Java Serializable class
body: <p>I have read various blogs about Serialization and the use of serialVersionUID.  Most of them mention using it to maintain the state of a serializable class.</p>
  
  <p>The scenario I have is;</p>
  
  <p>I know the old serialVersionUID and the new serialVersionUID.</p>
  
  <p>On reading in an object with the old serialVersionUID I want to manipulate the data so it fits the new version, I only want to bother to do this if the object I am reading in is of the old type.</p>
  
  <p>This seems like something that should be very straight forwards!</p>
  
  <p>Is there a way to get hold of the serialVersionUID as the object is read in?</p>
  
  <p>The InvalidClassException is thrown before the readObject method in the serialized class is invoked so I can't access it there.</p>
  
  <p>The only hint I have found is to override the ObjectInputStream so that readClassDescriptor() is available although this seems a heavy weight solution to what must be a common problem!</p>
  
  <p>All help is gratefully received!</p>
  
  <p>M</p>