-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_2.6
Name: ooR10001 Date: 05/10/2000
java.awt.dnd.DragGestureEvent object could not be serialized because
corresponding class has non-transient and non-static field 'dragSource' of
non-Serializable class java.awt.dnd.DragSource. This field must be transient.
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.util.Vector x = new java.util.Vector();
x.add(new java.awt.Button("string"));
java.awt.dnd.DragGestureEvent obj = new java.awt.dnd.DragGestureEvent(
(new java.awt.dnd.DragSource()).createDefaultDragGestureRecognizer(
new java.awt.Button("string"),
java.awt.dnd.DnDConstants.ACTION_COPY,
null),
java.awt.dnd.DnDConstants.ACTION_COPY,
new java.awt.Point(1,1),
(java.util.List)x);
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.dnd.DragSource
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:21)
<program hangs>
-------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4402936 java.awt.dnd package needs a coherent serialization scheme
-
- Resolved
-