summaryrefslogtreecommitdiff
path: root/sources
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
parentf7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff)
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources')
-rw-r--r--sources/core/VSProcess.java12
-rw-r--r--sources/core/VSTask.java12
-rw-r--r--sources/core/VSTaskManager.java11
-rw-r--r--sources/events/VSAbstractEvent.java12
-rw-r--r--sources/events/internal/VSMessageReceiveEvent.java40
-rw-r--r--sources/events/internal/VSProtocolEvent.java16
-rw-r--r--sources/events/internal/VSProtocolScheduleEvent.java37
-rw-r--r--sources/prefs/VSPrefs.java25
-rw-r--r--sources/protocols/VSAbstractProtocol.java33
-rw-r--r--sources/serialize/VSSerialize.java76
-rw-r--r--sources/simulator/VSSimulator.java14
-rw-r--r--sources/simulator/VSSimulatorCanvas.java14
-rw-r--r--sources/simulator/VSSimulatorFrame.java4
13 files changed, 249 insertions, 57 deletions
diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java
index c6456de..9842321 100644
--- a/sources/core/VSProcess.java
+++ b/sources/core/VSProcess.java
@@ -1024,12 +1024,18 @@ public class VSProcess extends VSPrefs implements VSSerializable {
System.out.println("Serializing: VSProcess (num: " + processNum
+ "; id: " + processID + ")");
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
objectOutputStream.writeObject(new Integer(processID));
objectOutputStream.writeObject(new Integer(protocolsToReset.size()));
for (VSAbstractProtocol protocol : protocolsToReset) {
objectOutputStream.writeObject(protocol.getClassname());
protocol.serialize(serialize, objectOutputStream);
}
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -1046,6 +1052,9 @@ public class VSProcess extends VSPrefs implements VSSerializable {
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSProcess");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
this.processID = ((Integer)
objectInputStream.readObject()).intValue();
int numProtocols = ((Integer)
@@ -1057,6 +1066,9 @@ public class VSProcess extends VSPrefs implements VSSerializable {
protocol.deserialize(serialize, objectInputStream);
}
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
serialize.setObject(processNum, "process", this);
}
}
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java
index 1b8f744..c1323e8 100644
--- a/sources/core/VSTask.java
+++ b/sources/core/VSTask.java
@@ -362,6 +362,9 @@ public class VSTask implements Comparable, 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(new Integer(process.getProcessNum()));
objectOutputStream.writeObject(event.getClassname());
objectOutputStream.writeObject(new Integer(event.getID()));
@@ -370,6 +373,9 @@ public class VSTask implements Comparable, VSSerializable {
objectOutputStream.writeObject(new Long(taskTime));
objectOutputStream.writeObject(new Boolean(isGlobalTimed));
objectOutputStream.writeObject(new Boolean(isProgrammed));
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -383,6 +389,9 @@ public class VSTask implements Comparable, VSSerializable {
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSTask");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
int processNum = ((Integer) objectInputStream.readObject()).intValue();
VSProcess process = (VSProcess)
serialize.getObject(processNum, "process");
@@ -412,6 +421,9 @@ public class VSTask implements Comparable, VSSerializable {
serialize.setObject(taskNum, "task", this);
init(taskTime, process, event, !isGlobalTimed.booleanValue());
this.isProgrammed = isProgrammed.booleanValue();
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
}
}
diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java
index 272a52c..d4ee83c 100644
--- a/sources/core/VSTaskManager.java
+++ b/sources/core/VSTaskManager.java
@@ -503,6 +503,8 @@ public class VSTaskManager 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));
ArrayList<VSTask> tasks = new ArrayList<VSTask>();
@@ -526,6 +528,9 @@ public class VSTaskManager implements VSSerializable {
objectOutputStream.writeObject(new Integer(tasks.size()));
for (VSTask task : tasks)
task.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -539,6 +544,9 @@ public class VSTaskManager implements VSSerializable {
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSTaskManager");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
globalTasks.clear();
ArrayList<VSProcess> processes = simulatorCanvas.getProcesses();
@@ -552,5 +560,8 @@ public class VSTaskManager implements VSSerializable {
VSTask task = new VSTask(serialize, objectInputStream);
addTask(task, task.isProgrammed());
}
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
}
}
diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java
index 0dd814c..0bc5ec8 100644
--- a/sources/events/VSAbstractEvent.java
+++ b/sources/events/VSAbstractEvent.java
@@ -177,9 +177,15 @@ abstract public class VSAbstractEvent extends VSPrefs {
if (VSSerialize.DEBUG)
System.out.println("Serializing: VSAbstractEvent; id="+getID());
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
objectOutputStream.writeObject(new Integer(super.getID()));
objectOutputStream.writeObject(eventShortname);
objectOutputStream.writeObject(eventClassname);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -195,6 +201,9 @@ abstract public class VSAbstractEvent extends VSPrefs {
if (VSSerialize.DEBUG)
System.out.print("Deserializing: VSAbstractEvent ");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
int id = ((Integer) objectInputStream.readObject()).intValue();
this.eventShortname = (String) objectInputStream.readObject();
this.eventClassname = (String) objectInputStream.readObject();
@@ -203,5 +212,8 @@ abstract public class VSAbstractEvent extends VSPrefs {
System.out.println(eventClassname);
serialize.setObject(id, "event", this);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
}
}
diff --git a/sources/events/internal/VSMessageReceiveEvent.java b/sources/events/internal/VSMessageReceiveEvent.java
index 0cffa86..8972ce5 100644
--- a/sources/events/internal/VSMessageReceiveEvent.java
+++ b/sources/events/internal/VSMessageReceiveEvent.java
@@ -23,9 +23,12 @@
package events.internal;
+import java.io.*;
+
import core.VSMessage;
import events.VSAbstractEvent;
import protocols.VSAbstractProtocol;
+import serialize.VSSerialize;
/**
* The class VSMessageReceiveEvent. This event is used if a process receives
@@ -106,4 +109,41 @@ public class VSMessageReceiveEvent extends VSAbstractEvent {
return true;
}
+
+ /* (non-Javadoc)
+ * @see serialize.VSSerializable#serialize(serialize.VSSerialize,
+ * java.io.ObjectOutputStream)
+ */
+ public synchronized void serialize(VSSerialize serialize,
+ ObjectOutputStream objectOutputStream)
+ throws IOException {
+ super.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+ }
+
+ /* (non-Javadoc)
+ * @see serialize.VSSerializable#deserialize(serialize.VSSerialize,
+ * java.io.ObjectInputStream)
+ */
+ @SuppressWarnings("unchecked")
+ public synchronized void deserialize(VSSerialize serialize,
+ ObjectInputStream objectInputStream)
+ throws IOException, ClassNotFoundException {
+ super.deserialize(serialize, objectInputStream);
+
+ if (VSSerialize.DEBUG)
+ System.out.println("Deserializing: VSProtocolEvent");
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
+ }
}
diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java
index 5f5ceb4..8d6b2dd 100644
--- a/sources/events/internal/VSProtocolEvent.java
+++ b/sources/events/internal/VSProtocolEvent.java
@@ -27,7 +27,7 @@ import java.io.*;
import events.*;
import protocols.VSAbstractProtocol;
-import serialize.*;
+import serialize.VSSerialize;
/**
* The class VSProtocolEvent. This event is used if a protocol (server or
@@ -144,9 +144,16 @@ public class VSProtocolEvent extends VSAbstractEvent {
ObjectOutputStream objectOutputStream)
throws IOException {
super.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
objectOutputStream.writeObject(protocolClassname);
objectOutputStream.writeObject(new Boolean(isClientProtocol));
objectOutputStream.writeObject(new Boolean(isProtocolActivation));
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -162,10 +169,17 @@ public class VSProtocolEvent extends VSAbstractEvent {
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSProtocolEvent");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
protocolClassname = (String) objectInputStream.readObject();
isClientProtocol = ((Boolean)
objectInputStream.readObject()).booleanValue();;
isProtocolActivation = ((Boolean)
objectInputStream.readObject()).booleanValue();;
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
}
}
diff --git a/sources/events/internal/VSProtocolScheduleEvent.java b/sources/events/internal/VSProtocolScheduleEvent.java
index 912b552..99ae020 100644
--- a/sources/events/internal/VSProtocolScheduleEvent.java
+++ b/sources/events/internal/VSProtocolScheduleEvent.java
@@ -23,8 +23,11 @@
package events.internal;
+import java.io.*;
+
import events.*;
import protocols.VSAbstractProtocol;
+import serialize.VSSerialize;
/**
* The class VSProtocolScheduleEvent. This event is used if a protocol (which
@@ -110,4 +113,38 @@ public class VSProtocolScheduleEvent extends VSAbstractEvent {
else
protocol.onClientScheduleStart();
}
+
+ /* (non-Javadoc)
+ * @see serialize.VSSerializable#serialize(serialize.VSSerialize,
+ * java.io.ObjectOutputStream)
+ */
+ public synchronized void serialize(VSSerialize serialize,
+ ObjectOutputStream objectOutputStream)
+ throws IOException {
+ super.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+ }
+
+ /* (non-Javadoc)
+ * @see serialize.VSSerializable#deserialize(serialize.VSSerialize,
+ * java.io.ObjectInputStream)
+ */
+ @SuppressWarnings("unchecked")
+ public synchronized void deserialize(VSSerialize serialize,
+ ObjectInputStream objectInputStream)
+ throws IOException, ClassNotFoundException {
+ super.deserialize(serialize, objectInputStream);
+
+ if (VSSerialize.DEBUG)
+ System.out.println("Deserializing: VSProtocolEvent");
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
+ }
}
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();
}
/**
diff --git a/sources/protocols/VSAbstractProtocol.java b/sources/protocols/VSAbstractProtocol.java
index 9999f62..39d338a 100644
--- a/sources/protocols/VSAbstractProtocol.java
+++ b/sources/protocols/VSAbstractProtocol.java
@@ -111,15 +111,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
if (hasOnServerStart) {
if (isServer) {
currentContextIsServer(true);
- if (!isServerInitialized)
- onInit();
+ if (!isServerInitialized)
+ onInit();
onServerStart();
}
} else {
if (isClient) {
currentContextIsServer(false);
- if (!isClientInitialized)
- onInit();
+ if (!isClientInitialized)
+ onInit();
onClientStart();
}
}
@@ -132,13 +132,13 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
if (isClient) {
currentContextIsServer(false);
onClientInit();
- isClientInitialized = true;
+ isClientInitialized = true;
}
if (isServer) {
currentContextIsServer(true);
onServerInit();
- isServerInitialized = true;
+ isServerInitialized = true;
}
}
@@ -173,15 +173,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
if (isServer) {
currentContextIsServer(true);
- if (!isServerInitialized)
- onInit();
+ if (!isServerInitialized)
+ onInit();
onServerRecv(message);
}
if (isClient) {
currentContextIsServer(false);
- if (!isClientInitialized)
- onInit();
+ if (!isClientInitialized)
+ onInit();
onClientRecv(message);
}
}
@@ -408,7 +408,14 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
ObjectOutputStream objectOutputStream)
throws IOException {
super.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
objectOutputStream.writeObject(new Boolean(hasOnServerStart));
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
}
/* (non-Javadoc)
@@ -424,7 +431,13 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
if (VSSerialize.DEBUG)
System.out.println("Deserializing: VSAbstractProtocol");
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
this.hasOnServerStart = ((Boolean)
objectInputStream.readObject()).booleanValue();
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
}
}
diff --git a/sources/serialize/VSSerialize.java b/sources/serialize/VSSerialize.java
index 7591ea1..0d44d31 100644
--- a/sources/serialize/VSSerialize.java
+++ b/sources/serialize/VSSerialize.java
@@ -159,12 +159,12 @@ public final class VSSerialize {
* @param simulator The simulator
*/
public void saveSimulator(String filename, VSSimulator simulator) {
- if (filename == null) {
- saveSimulator(simulator);
- return;
- }
+ if (filename == null) {
+ saveSimulator(simulator);
+ return;
+ }
- LAST_FILENAME = filename;
+ LAST_FILENAME = filename;
try {
FileOutputStream fileOutputStream =
@@ -177,7 +177,7 @@ public final class VSSerialize {
simulator.serialize(this, objectOutputStream);
} catch (IOException e) {
- e.printStackTrace();
+ //e.printStackTrace();
} finally {
//objectOutputStream.close();
@@ -190,17 +190,17 @@ public final class VSSerialize {
* @param simulator The simulator
*/
public void saveSimulator(VSSimulator simulator) {
- VSPrefs prefs = simulator.getPrefs();
- VSSimulatorFrame simulatorFrame = simulator.getSimulatorFrame();
+ VSPrefs prefs = simulator.getPrefs();
+ VSSimulatorFrame simulatorFrame = simulator.getSimulatorFrame();
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setMultiSelectionEnabled(false);
- fileChooser.addChoosableFileFilter(createFileFilter(prefs));
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setMultiSelectionEnabled(false);
+ fileChooser.addChoosableFileFilter(createFileFilter(prefs));
- if (fileChooser.showOpenDialog(simulatorFrame) ==
- JFileChooser.APPROVE_OPTION)
- saveSimulator(fileChooser.getSelectedFile().getName(),
- simulator);
+ if (fileChooser.showOpenDialog(simulatorFrame) ==
+ JFileChooser.APPROVE_OPTION)
+ saveSimulator(fileChooser.getSelectedFile().getName(),
+ simulator);
}
/**
@@ -230,7 +230,7 @@ public final class VSSerialize {
simulator.deserialize(this, objectInputStream);
} catch (Exception e) {
- e.printStackTrace();
+ //e.printStackTrace();
} finally {
//objectInputStream.close();
@@ -247,38 +247,38 @@ public final class VSSerialize {
* @return The simulator object, and null if no success
*/
public VSSimulator openSimulator(VSSimulatorFrame simulatorFrame) {
- VSPrefs prefs = simulatorFrame.getPrefs();
+ VSPrefs prefs = simulatorFrame.getPrefs();
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setMultiSelectionEnabled(false);
- fileChooser.addChoosableFileFilter(createFileFilter(prefs));
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setMultiSelectionEnabled(false);
+ fileChooser.addChoosableFileFilter(createFileFilter(prefs));
- if (fileChooser.showOpenDialog(simulatorFrame) ==
- JFileChooser.APPROVE_OPTION)
- return openSimulator(fileChooser.getSelectedFile().getName(),
- simulatorFrame);
+ if (fileChooser.showOpenDialog(simulatorFrame) ==
+ JFileChooser.APPROVE_OPTION)
+ return openSimulator(fileChooser.getSelectedFile().getName(),
+ simulatorFrame);
return null;
}
/**
* Creates a file filter for the file choosers
- *
- * @param prefs The default prefs
+ *
+ * @param prefs The default prefs
*/
private javax.swing.filechooser.FileFilter createFileFilter(
- final VSPrefs prefs) {
- return new javax.swing.filechooser.FileFilter() {
- public boolean accept(File file) {
- if (file.isDirectory())
- return true;
- return file.getName().toLowerCase().endsWith(".dat");
- }
-
- public String getDescription() {
- return prefs.getString("lang.dat");
- }
- };
+ final VSPrefs prefs) {
+ return new javax.swing.filechooser.FileFilter() {
+ public boolean accept(File file) {
+ if (file.isDirectory())
+ return true;
+ return file.getName().toLowerCase().endsWith(".dat");
+ }
+
+ public String getDescription() {
+ return prefs.getString("lang.dat");
+ }
+ };
}
}
diff --git a/sources/simulator/VSSimulator.java b/sources/simulator/VSSimulator.java
index aec330e..0a7c6c2 100644
--- a/sources/simulator/VSSimulator.java
+++ b/sources/simulator/VSSimulator.java
@@ -1232,7 +1232,14 @@ public class VSSimulator extends JPanel 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));
+
simulatorCanvas.serialize(serialize, objectOutputStream);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectOutputStream.writeObject(new Boolean(false));
+
}
/* (non-Javadoc)
@@ -1248,8 +1255,15 @@ public class VSSimulator extends JPanel implements VSSerializable {
serialize.setObject("simulator", this);
serialize.setObject("logging", logging);
+
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
simulatorCanvas.deserialize(serialize, objectInputStream);
+ /** For later backwards compatibility, to add more stuff */
+ objectInputStream.readObject();
+
updateFromPrefs();
updateTaskManagerTable();
}
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();
}
}
diff --git a/sources/simulator/VSSimulatorFrame.java b/sources/simulator/VSSimulatorFrame.java
index 2b9042c..ad095c4 100644
--- a/sources/simulator/VSSimulatorFrame.java
+++ b/sources/simulator/VSSimulatorFrame.java
@@ -149,8 +149,8 @@ public class VSSimulatorFrame extends VSFrame {
VSSerialize serialize = new VSSerialize();
VSSimulator simulator = serialize.openSimulator(
VSSimulatorFrame.this);
- if (simulator != null)
- addSimulator(simulator);
+ if (simulator != null)
+ addSimulator(simulator);
} else if (sourceText.equals(
finalPrefs.getString("lang.save"))) {