Increased serialization version to 7. String properties are now serialized

as objects, because there seems to be a limit around 60000 chars for UTF.
This commit is contained in:
hns 2001-11-20 17:01:55 +00:00
parent 56e5201f8e
commit 2ca5232637
2 changed files with 7 additions and 3 deletions

View file

@ -107,7 +107,7 @@ public final class Node implements INode, Serializable {
* Write out this instance to a stream * Write out this instance to a stream
*/ */
private void writeObject (ObjectOutputStream out) throws IOException { private void writeObject (ObjectOutputStream out) throws IOException {
out.writeShort (6); // serialization version out.writeShort (7); // serialization version
out.writeUTF (id); out.writeUTF (id);
out.writeUTF (name); out.writeUTF (name);
out.writeObject (parentHandle); out.writeObject (parentHandle);

View file

@ -40,7 +40,11 @@ public final class Property implements IProperty, Serializable, Cloneable {
type = in.readInt (); type = in.readInt ();
switch (type) { switch (type) {
case STRING: case STRING:
svalue = in.readUTF (); // try to convert from old format
if (node.version < 7)
svalue = in.readUTF ();
else
svalue = (String) in.readObject ();
break; break;
case BOOLEAN: case BOOLEAN:
bvalue = in.readBoolean (); bvalue = in.readBoolean ();
@ -74,7 +78,7 @@ public final class Property implements IProperty, Serializable, Cloneable {
out.writeInt (type); out.writeInt (type);
switch (type) { switch (type) {
case STRING: case STRING:
out.writeUTF (svalue); out.writeObject (svalue);
break; break;
case BOOLEAN: case BOOLEAN:
out.writeBoolean (bvalue); out.writeBoolean (bvalue);