java.lang.RuntimeException: dndGesture.dragboard is null in dragDrop

JDK Bug System | Webbug Group | 6 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    FULL PRODUCT VERSION : java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode) ADDITIONAL OS VERSION INFORMATION : Mac OS X' Version '10.11.6' Arch 'x86_64' A DESCRIPTION OF THE PROBLEM : Using the demo javafx drag and drop example from here: http://docs.oracle.com/javafx/2/drag_drop/HelloDragAndDrop.java.html (source included below) If you drag a file onto the window and before letting go of the left button, press the right mouse button you get a java crash. Only happens on MacOSX, have tried the same on Windows 7 & 10 and Linux Mint and they are OK. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Run demo app 2. Drag a file onto the window 3. Before releasing left mouse button, press the right mouse button. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Shouldn't crash ACTUAL - Crashes ERROR MESSAGES/STACK TRACES THAT OCCUR : java.lang.RuntimeException: dndGesture.dragboard is null in dragDrop at javafx.scene.Scene$DropTargetListener.drop(Scene.java:2863) ~[jfxrt.jar:?] at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.lambda$handleDragDrop$309(GlassSceneDnDEventHandler.java:95) ~[jfxrt.jar:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_101] at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragDrop(GlassSceneDnDEventHandler.java:92) ~[jfxrt.jar:?] at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleDragDrop$363(GlassViewEventHandler.java:700) ~[jfxrt.jar:?] at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) ~[jfxrt.jar:?] at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragDrop(GlassViewEventHandler.java:699) ~[jfxrt.jar:?] at com.sun.glass.ui.View.handleDragDrop(View.java:712) ~[jfxrt.jar:?] at com.sun.glass.ui.View.notifyDragDrop(View.java:1037) ~[jfxrt.jar:?] REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package hellodraganddrop; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.*; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.stage.Stage; /** * Demonstrates a drag-and-drop feature. */ public class HelloDragAndDrop extends Application { @Override public void start(Stage stage) { stage.setTitle("Hello Drag And Drop"); Group root = new Group(); Scene scene = new Scene(root, 400, 200); scene.setFill(Color.LIGHTGREEN); final Text source = new Text(50, 100, "DRAG ME"); source.setScaleX(2.0); source.setScaleY(2.0); final Text target = new Text(250, 100, "DROP HERE"); target.setScaleX(2.0); target.setScaleY(2.0); source.setOnDragDetected(new EventHandler <MouseEvent>() { public void handle(MouseEvent event) { /* drag was detected, start drag-and-drop gesture*/ System.out.println("onDragDetected"); /* allow any transfer mode */ Dragboard db = source.startDragAndDrop(TransferMode.ANY); /* put a string on dragboard */ ClipboardContent content = new ClipboardContent(); content.putString(source.getText()); db.setContent(content); event.consume(); } }); target.setOnDragOver(new EventHandler <DragEvent>() { public void handle(DragEvent event) { /* data is dragged over the target */ System.out.println("onDragOver"); /* accept it only if it is not dragged from the same node * and if it has a string data */ if (event.getGestureSource() != target && event.getDragboard().hasString()) { /* allow for both copying and moving, whatever user chooses */ event.acceptTransferModes(TransferMode.COPY_OR_MOVE); } event.consume(); } }); target.setOnDragEntered(new EventHandler <DragEvent>() { public void handle(DragEvent event) { /* the drag-and-drop gesture entered the target */ System.out.println("onDragEntered"); /* show to the user that it is an actual gesture target */ if (event.getGestureSource() != target && event.getDragboard().hasString()) { target.setFill(Color.GREEN); } event.consume(); } }); target.setOnDragExited(new EventHandler <DragEvent>() { public void handle(DragEvent event) { /* mouse moved away, remove the graphical cues */ target.setFill(Color.BLACK); event.consume(); } }); target.setOnDragDropped(new EventHandler <DragEvent>() { public void handle(DragEvent event) { /* data dropped */ System.out.println("onDragDropped"); /* if there is a string data on dragboard, read it and use it */ Dragboard db = event.getDragboard(); boolean success = false; if (db.hasString()) { target.setText(db.getString()); success = true; } /* let the source know whether the string was successfully * transferred and used */ event.setDropCompleted(success); event.consume(); } }); source.setOnDragDone(new EventHandler <DragEvent>() { public void handle(DragEvent event) { /* the drag-and-drop gesture ended */ System.out.println("onDragDone"); /* if the data was successfully moved, clear it */ if (event.getTransferMode() == TransferMode.MOVE) { source.setText(""); } event.consume(); } }); root.getChildren().add(source); root.getChildren().add(target); stage.setScene(scene); stage.show(); } public static void main(String[] args) { Application.launch(args); } } ---------- END SOURCE ----------

    JDK Bug System | 6 months ago | Webbug Group
    java.lang.RuntimeException: dndGesture.dragboard is null in dragDrop

    Root Cause Analysis

    1. java.lang.RuntimeException

      dndGesture.dragboard is null in dragDrop

      at javafx.scene.Scene$DropTargetListener.drop()
    2. javafx.scene
      Scene$DropTargetListener.drop
      1. javafx.scene.Scene$DropTargetListener.drop(Scene.java:2863)[jfxrt.jar:?]
      1 frame
    3. com.sun.javafx
      GlassSceneDnDEventHandler.lambda$handleDragDrop$309
      1. com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.lambda$handleDragDrop$309(GlassSceneDnDEventHandler.java:95)[jfxrt.jar:?]
      1 frame
    4. Java RT
      AccessController.doPrivileged
      1. java.security.AccessController.doPrivileged(Native Method)[?:1.8.0_101]
      1 frame
    5. com.sun.javafx
      GlassViewEventHandler.handleDragDrop
      1. com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragDrop(GlassSceneDnDEventHandler.java:92)[jfxrt.jar:?]
      2. com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleDragDrop$363(GlassViewEventHandler.java:700)[jfxrt.jar:?]
      3. com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)[jfxrt.jar:?]
      4. com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragDrop(GlassViewEventHandler.java:699)[jfxrt.jar:?]
      4 frames
    6. com.sun.glass
      View.notifyDragDrop
      1. com.sun.glass.ui.View.handleDragDrop(View.java:712)[jfxrt.jar:?]
      2. com.sun.glass.ui.View.notifyDragDrop(View.java:1037)[jfxrt.jar:?]
      2 frames