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

JDK Bug System | Webbug Group | 7 months ago
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards 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: (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( ~[jfxrt.jar:?] at$handleDragDrop$309( ~[jfxrt.jar:?] at Method) ~[?:1.8.0_101] at ~[jfxrt.jar:?] at$handleDragDrop$363( ~[jfxrt.jar:?] at ~[jfxrt.jar:?] at ~[jfxrt.jar:?] at ~[jfxrt.jar:?] at ~[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);; } public static void main(String[] args) { Application.launch(args); } } ---------- END SOURCE ----------

    JDK Bug System | 7 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
      1. javafx.scene.Scene$DropTargetListener.drop([jfxrt.jar:?]
      1 frame
    3. com.sun.javafx
      1 frame
    4. Java RT
      1. Method)[?:1.8.0_101]
      1 frame
    5. com.sun.javafx
      4 frames
      2 frames