-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta
-
generic
-
generic
-
Verified
This problem starts on Merlin-beta build 30. Tried it on the previous builds and it didn't show up.
While trying to serialize and deserialize JToolBar, the following exception gets thrown:
java.io.NotSerializableException: javax.swing.JToolBar$DefaultToolBarLayout
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
at java.awt.Container.writeObject(Container.java:1789)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java:1878)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1210)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at TestSerialize.serializeAndDeserialize(TestSerialize.java:30)
at TestSerialize.<init>(TestSerialize.java:17)
at TestSerialize.main(TestSerialize.java:10)
Here is a simple test program to reproduce the problem:
---------------------------------------------------------------------------------
import java.io.*;
import javax.swing.*;
public class TestSerialize {
JToolBar toolBar1;
public static void main(String[] args) {
new TestSerialize();
}
public TestSerialize() {
toolBar1 = new JToolBar();
try {
serializeAndDeserialize(toolBar1);
} catch(Exception e) {
e.printStackTrace();
}
System.exit(0);
}
private Object serializeAndDeserialize(Object toWrite)
throws ClassNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream("cereal.dat");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(toWrite);
oos.flush();
fos.close();
FileInputStream fis = new FileInputStream("cereal.dat");
ObjectInputStream ois = new ObjectInputStream(fis);
Object retVal = ois.readObject();
fis.close();
return retVal;
}
}
---------------------------------------------------------------------------------
edmund.lou@eng 2000-09-01
Swing SQE
While trying to serialize and deserialize JToolBar, the following exception gets thrown:
java.io.NotSerializableException: javax.swing.JToolBar$DefaultToolBarLayout
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
at java.awt.Container.writeObject(Container.java:1789)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java:1878)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1210)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at TestSerialize.serializeAndDeserialize(TestSerialize.java:30)
at TestSerialize.<init>(TestSerialize.java:17)
at TestSerialize.main(TestSerialize.java:10)
Here is a simple test program to reproduce the problem:
---------------------------------------------------------------------------------
import java.io.*;
import javax.swing.*;
public class TestSerialize {
JToolBar toolBar1;
public static void main(String[] args) {
new TestSerialize();
}
public TestSerialize() {
toolBar1 = new JToolBar();
try {
serializeAndDeserialize(toolBar1);
} catch(Exception e) {
e.printStackTrace();
}
System.exit(0);
}
private Object serializeAndDeserialize(Object toWrite)
throws ClassNotFoundException, IOException {
FileOutputStream fos = new FileOutputStream("cereal.dat");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(toWrite);
oos.flush();
fos.close();
FileInputStream fis = new FileInputStream("cereal.dat");
ObjectInputStream ois = new ObjectInputStream(fis);
Object retVal = ois.readObject();
fis.close();
return retVal;
}
}
---------------------------------------------------------------------------------
edmund.lou@eng 2000-09-01
Swing SQE