summaryrefslogtreecommitdiff
path: root/sources/simulator/VSSimulatorCanvas.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-03 16:41:37 +0000
committerPaul Buetow <paul@buetow.org>2008-06-03 16:41:37 +0000
commit11af1c9fa7fe66e10de0a92878311b4e22befb0f (patch)
tree8dfc7af2ec18eb5889327426bc6fdb7379a3feba /sources/simulator/VSSimulatorCanvas.java
parentf7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff)
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources/simulator/VSSimulatorCanvas.java')
-rw-r--r--sources/simulator/VSSimulatorCanvas.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/sources/simulator/VSSimulatorCanvas.java b/sources/simulator/VSSimulatorCanvas.java
index 1b30a51..b521fc7 100644
--- a/sources/simulator/VSSimulatorCanvas.java
+++ b/sources/simulator/VSSimulatorCanvas.java
@@ -1571,6 +1571,9 @@ public class VSSimulatorCanvas extends Canvas
public synchronized void serialize(VSSerialize serialize,
ObjectOutputStream objectOutputStream)
throws IOException {
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
synchronized (processes) {
objectOutputStream.writeObject(new Integer(numProcesses));
for (VSProcess process : processes)
@@ -1578,6 +1581,9 @@ public class VSSimulatorCanvas extends Canvas
}
taskManager.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -1591,6 +1597,9 @@ public class VSSimulatorCanvas extends Canvas
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSSimulatorCanvas");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
int num = ((Integer) objectInputStream.readObject()).intValue();
logging.clear();
@@ -1604,8 +1613,11 @@ public class VSSimulatorCanvas extends Canvas
}
for (int i = 0; i < num; ++i)
- processes.get(0).deserialize(serialize, objectInputStream);
+ processes.get(i).deserialize(serialize, objectInputStream);
taskManager.deserialize(serialize, objectInputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
}
}