diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-03 16:41:37 +0000 |
| commit | 11af1c9fa7fe66e10de0a92878311b4e22befb0f (patch) | |
| tree | 8dfc7af2ec18eb5889327426bc6fdb7379a3feba /sources/prefs/VSPrefs.java | |
| parent | f7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff) | |
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources/prefs/VSPrefs.java')
| -rw-r--r-- | sources/prefs/VSPrefs.java | 25 |
1 files changed, 20 insertions, 5 deletions
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<String,Boolean>) objectInputStream.readObject(); colorPrefs = (HashMap<String,Color>) objectInputStream.readObject(); - descriptionPrefs = new HashMap<String,String>(); + descriptionPrefs = (HashMap<String,String>) + objectInputStream.readObject(); floatPrefs = (HashMap<String,Float>) objectInputStream.readObject(); integerPrefs = (HashMap<String,Integer>) objectInputStream.readObject(); - vectorPrefs = (HashMap<String,Vector<Integer>>) - objectInputStream.readObject(); longPrefs = (HashMap<String,Long>) objectInputStream.readObject(); restrictions = new HashMap<String,VSPrefsRestriction>(); stringPrefs = (HashMap<String,String>) objectInputStream.readObject(); units = (HashMap<String,String>) objectInputStream.readObject(); - objectPrefs.clear(); + vectorPrefs = (HashMap<String,Vector<Integer>>) + objectInputStream.readObject(); + + /** For later backwards compatibility, to add more stuff */ + objectInputStream.readObject(); } /** |
