-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
sparc
-
solaris_2.6
Name: ooR10001 Date: 04/13/2000
If method createContext() is invoked, the object is no longer serializable.
Object's field theContext is initialized with non-Serializable class
instance of java.awt.ColorPaintContext. This is causing the problem.
The test example to reproduce the bug:
-------------------------------------------------------------
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
public class test {
public static void main(String[] args) {
try {
java.awt.Color cobj = new java.awt.Color(255,255,255);
cobj.createContext(
new java.awt.image.IndexColorModel(
8, 1, new byte[] {0}, new byte[] {0}, new byte[] {0}),
new java.awt.Rectangle(1,1,2,3),
new java.awt.Rectangle(3,3),
new java.awt.geom.AffineTransform(),
new java.awt.RenderingHints(null)
);
FileOutputStream ostream = new FileOutputStream("gold.tmp");
ObjectOutputStream objos = new ObjectOutputStream(ostream);
objos.writeObject(cobj);
objos.close();
System.out.println("OKAY");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}
-------------------------------------------------------------
Test output:
java.io.NotSerializableException: java.awt.ColorPaintContext
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.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at test.main(test.java:19)
-------------------------------------------------------------
======================================================================