From 11af1c9fa7fe66e10de0a92878311b4e22befb0f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 3 Jun 2008 16:41:37 +0000 Subject: made future serialized class versions backwards compatible. --- sources/prefs/VSPrefs.java | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'sources/prefs/VSPrefs.java') diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java index de1c249..f17732c 100644 --- a/sources/prefs/VSPrefs.java +++ b/sources/prefs/VSPrefs.java @@ -944,14 +944,21 @@ public class VSPrefs implements VSSerializable { public synchronized void serialize(VSSerialize serialize, ObjectOutputStream objectOutputStream) throws IOException { + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(booleanPrefs); objectOutputStream.writeObject(colorPrefs); + objectOutputStream.writeObject(descriptionPrefs); objectOutputStream.writeObject(floatPrefs); objectOutputStream.writeObject(integerPrefs); - objectOutputStream.writeObject(vectorPrefs); objectOutputStream.writeObject(longPrefs); objectOutputStream.writeObject(stringPrefs); objectOutputStream.writeObject(units); + objectOutputStream.writeObject(vectorPrefs); + + /** For later backwards compatibility, to add more stuff */ + objectOutputStream.writeObject(new Boolean(false)); } /* (non-Javadoc) @@ -962,18 +969,26 @@ public class VSPrefs implements VSSerializable { public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { + objectPrefs.clear(); + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); + booleanPrefs = (HashMap) objectInputStream.readObject(); colorPrefs = (HashMap) objectInputStream.readObject(); - descriptionPrefs = new HashMap(); + descriptionPrefs = (HashMap) + objectInputStream.readObject(); floatPrefs = (HashMap) objectInputStream.readObject(); integerPrefs = (HashMap) objectInputStream.readObject(); - vectorPrefs = (HashMap>) - objectInputStream.readObject(); longPrefs = (HashMap) objectInputStream.readObject(); restrictions = new HashMap(); stringPrefs = (HashMap) objectInputStream.readObject(); units = (HashMap) objectInputStream.readObject(); - objectPrefs.clear(); + vectorPrefs = (HashMap>) + objectInputStream.readObject(); + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); } /** -- cgit v1.2.3