Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found this <a href="http://www.norwinter.com/2009/08/20/refactor-serializable-java-class/" rel="nofollow noreferrer">blog post</a> that claims to have a solution, though it doesn't spell it out very clearly.</p> <p>What it is actually saying is that you create a subclass of <code>ObjectInputStream</code> that overrides the <code>readClassDescriptor</code> method to do something like this:</p> <pre><code>@Override protected java.io.ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass desc = super.readClassDescriptor(); if (desc.getName().equals("oldpkg.Widget")) { return ObjectStreamClass.lookup(newpkg.Widget.class); } return desc; }; </code></pre> <hr> <p>You should also look at this <a href="https://stackoverflow.com/questions/4668675/replacing-class-name-in-serialized-data">SO question and its answers</a> which cover some of the same ground as your question.</p> <p>My advice would be: <strong>don't</strong> support the case where old versions of software read data serialized by the new version. </p> <ul> <li><p>This is a good opportunity to encourage (actually force) people to upgrade to the latest version of the code-base. Generally speaking, it is in <em>everyone's</em> interest that this happen sooner rather than later.</p></li> <li><p>If it is premature to force people to upgrade for other reasons, then (IMO) you should seriously consider <em>backing out</em> your changes to the class / package names. Wait until you've got a clear strategy / plan for upgrading that is 1) technically sound, and 2) acceptable to all stakeholders.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload