-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b15
-
generic
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8045739 | 8u25 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8039757 | 8u20 | Alexey Ivanov | P3 | Resolved | Fixed | b13 |
JDK-8053568 | emb-8u26 | Anton Litvinov | P3 | Resolved | Fixed | b17 |
JDK-8024063 | 7u80 | Alexey Ivanov | P3 | Resolved | Fixed | b01 |
JDK-8061005 | 7u79 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8057475 | 7u76 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8050355 | 7u75 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8049894 | 7u72 | Alexey Ivanov | P3 | Closed | Fixed | b04 |
When the DnD operation is initiated, the SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable() is called to
set the Transferable involved in the DnD operation; that method stores it into a protected static variable. When the processEnterMessage() is called, the value of the static variable is copied into an instance variable called "local"; this instance variable is then set to null when the paired processExitMessage() is called. The static Transferable variable is finally set to null by the cleanup() method of the SunDragSourceContextPeer class.
What happens is that if the DnD operation is performed quickly relatively to the processing that the application has to do during the DnD session (grabbing an object from one view, dragging and dropping it on another view in the time frame of a second or less) the cleanup() method gets called before the processEnterMessage() relative to the target view is entered. Consequently, when the processEnterMessage() executes, the static Transferable variable is null and so null becomes also the "local" variable. This makes the getTransferData() chain of calls follow a different path, which ends up with the exception:
java.lang.ClassCastException: DnD$DropObject cannot be cast to java.io.InputStream
at sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer.java:1186)
at sun.awt.datatransfer.DataTransferer$6.run(DataTransferer.java:2145)
at sun.awt.datatransfer.DataTransferer.processDataConversionRequests(DataTransferer.java:2202)
at sun.awt.X11.XSelection.waitForSelectionNotify(XSelection.java:200)
at sun.awt.X11.XSelection.getData(XSelection.java:340)
at sun.awt.X11.XDnDDropTargetProtocol.getData(XDnDDropTargetProtocol.java:841)
at sun.awt.X11.XDropTargetContextPeer.getNativeData(XDropTargetContextPeer.java:132)
at sun.awt.dnd.SunDropTargetContextPeer.getTransferData(SunDropTargetContextPeer.java:245)
at sun.awt.datatransfer.TransferableProxy.getTransferData(TransferableProxy.java:56)
at java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(DropTargetContext.java:359)
at DnD$DnDPanel$3.dragEnter(DnD.java:232)
at java.awt.dnd.DropTarget.dragEnter(DropTarget.java:341)
at sun.awt.dnd.SunDropTargetContextPeer.processEnterMessage(SunDropTargetContextPeer.java:312)
at sun.awt.X11.XDropTargetContextPeer.processEnterMessage(XDropTargetContextPeer.java:146)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEnterEvent(SunDropTargetContextPeer.java:779)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:747)
at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:30)
at java.awt.Component.dispatchEventImpl(Component.java:4508)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4366)
at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4304)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4163)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.io.IOException: Owner failed to convert data
at sun.awt.X11.XSelection.validateDataGetter(XSelection.java:486)
at sun.awt.X11.XSelection.getData(XSelection.java:350)
at sun.awt.X11.XDnDDropTargetProtocol.getData(XDnDDropTargetProtocol.java:841)
at sun.awt.X11.XDropTargetContextPeer.getNativeData(XDropTargetContextPeer.java:132)
at sun.awt.dnd.SunDropTargetContextPeer.getTransferData(SunDropTargetContextPeer.java:245)
at sun.awt.datatransfer.TransferableProxy.getTransferData(TransferableProxy.java:56)
at java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(DropTargetContext.java:359)
at DnD$DnDPanel$3.dragEnter(DnD.java:232)
at java.awt.dnd.DropTarget.dragEnter(DropTarget.java:341)
at sun.awt.dnd.SunDropTargetContextPeer.processEnterMessage(SunDropTargetContextPeer.java:312)
at sun.awt.X11.XDropTargetContextPeer.processEnterMessage(XDropTargetContextPeer.java:146)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEnterEvent(SunDropTargetContextPeer.java:779)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:747)
at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:30)
at java.awt.Component.dispatchEventImpl(Component.java:4508)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4366)
at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4304)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4163)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
This issue occurs when the processing of the various listeners' calls involved is not trivial. I found that the most affecting one is the
dragGestureRecognized() of the DragGestureListener. I have then created a test case that introduces a delay in that method. The test java class, called DnD is attached to this report.
To run without delay execute:
java DnD
To run with dealy execute:
java DnD <millis>
where <millis> is an integer number specifying the delay affecting dragGestureRecognized(). A value of 200 should make the exception occurr.
When the app is running try to drag and drop the blue square from the yellow panel to the pink one very quickly.
- backported by
-
JDK-8024063 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8039757 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8045739 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8050355 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8053568 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8057475 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8061005 Exception thrown when drag and drop between two components is executed quickly
-
- Resolved
-
-
JDK-8049894 Exception thrown when drag and drop between two components is executed quickly
-
- Closed
-
- relates to
-
JDK-8040248 Drag and drop between two components fails if performed quickly
-
- Open
-
-
JDK-8065098 JColorChooser no longer supports drag and drop between two JVM instances
-
- Resolved
-