jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java
changeset 23265 233f9231e202
parent 21278 ef8a3a2a72f2
child 23328 4c53a6ebc779
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Mon Jan 20 20:11:09 2014 +0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Wed Jan 22 12:35:43 2014 +0400
@@ -29,6 +29,8 @@
 import java.awt.Component;
 import java.awt.Point;
 
+import java.io.InvalidObjectException;
+import java.util.Collections;
 import java.util.TooManyListenersException;
 import java.util.ArrayList;
 
@@ -411,10 +413,21 @@
      *
      * @since 1.4
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
-        s.defaultReadObject();
+        ObjectInputStream.GetField f = s.readFields();
+
+        DragSource newDragSource = (DragSource)f.get("dragSource", null);
+        if (newDragSource == null) {
+            throw new InvalidObjectException("null DragSource");
+        }
+        dragSource = newDragSource;
+
+        component = (Component)f.get("component", null);
+        sourceActions = f.get("sourceActions", 0) & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        events = (ArrayList<InputEvent>)f.get("events", new ArrayList<>(1));
 
         dragGestureListener = (DragGestureListener)s.readObject();
     }