From: Brian S. <bri...@jb...> - 2006-02-07 18:08:42
|
User: bstansberry Date: 06/02/07 13:08:19 Modified: src/org/jboss/cache Tag: Branch_JBossCache_1_2_4_SP2 Fqn.java Log: [JBCACHE-422] Restore Fqn's serializable compatibility with 1.2.3 Revision Changes Path No revision No revision 1.12.12.1 +35 -15 JBossCache/src/org/jboss/cache/Fqn.java (In the diff below, changes in quantity of whitespace are not shown.) Index: Fqn.java =================================================================== RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Fqn.java,v retrieving revision 1.12 retrieving revision 1.12.12.1 diff -u -b -r1.12 -r1.12.12.1 --- Fqn.java 12 Sep 2005 16:30:58 -0000 1.12 +++ Fqn.java 7 Feb 2006 18:08:19 -0000 1.12.12.1 @@ -20,14 +20,20 @@ * Fully qualified name. Essentially a list of relative names, from root * to a given node. This class is immutable. * - * @version $Revision: 1.12 $ + * @version $Revision: 1.12.12.1 $ */ public class Fqn implements Cloneable, Externalizable { private List elements=new ArrayList(5); private transient int hash_code=-1; private transient boolean hash_code_set=false; - static final long serialVersionUID = 8079182626777653881L; + /** + * Controls the implementation of read/writeExternal. + * Package protected so TreeCache can set it when StateTransferVersion is set. + */ + static boolean REL_123_COMPATIBLE = false; + + private static final long serialVersionUID = -5351930616956603651L; public Fqn() { } @@ -163,7 +169,13 @@ public void writeExternal(ObjectOutput out) throws IOException { - // out.writeObject(elements); + + if (REL_123_COMPATIBLE) + { + out.writeObject(elements); + } + else + { out.writeShort(elements.size()); Object element; for(Iterator it=elements.iterator(); it.hasNext();) { @@ -171,9 +183,16 @@ out.writeObject(element); } } + } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - // elements=(List)in.readObject(); + + if (REL_123_COMPATIBLE) + { + elements=(List)in.readObject(); + } + else + { short length=in.readShort(); Object element; for(int i=0; i < length; i++) { @@ -181,6 +200,7 @@ elements.add(element); } } + } /** |