-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.6
Name: ooR10001 Date: 04/20/2000
If method addPropertychangeListener() is invoked, the object is no longer
serializable.
For example, it could be invoked with instance of
java.beans.beancontext.BeanContextSupport.
In this case object's field 'accessibleAWTComponentHandler' will be initialized
with non-Serializable class instance of
java.awt.Component$AccessibleAWTComponent.AccessibleAWTComponentHandler. This
causes the problem.
This is a side effect of calling addPropertychangeListener() method and it
should be eliminated.
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 {
javax.accessibility.AccessibleContext obj =
new java.awt.Button("string").getAccessibleContext();
obj.addPropertyChangeListener(
new java.beans.beancontext.BeanContextSupport());
FileOutputStream ostream = new FileOutputStream("gold.tmp");
ObjectOutputStream objos = new ObjectOutputStream(ostream);
objos.writeObject(obj);
objos.close();
System.out.println("OKAY");
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}
-------------------------------------------------------------
Test output:
java.io.NotSerializableException:
java.awt.Component$AccessibleAWTComponent$AccessibleAWTComponentHandler
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:15)
-------------------------------------------------------------
======================================================================