-
Bug
-
Resolution: Fixed
-
P4
-
8u20
-
None
I was looking into RT-36686 and run into an interesting bug which appears to be occuring at the glass level, so I thought I better report it.
Steps to reproduce:
1) Open the HelloListView class file.
2) Search for the line: listTwo.setItems(listTwoItems);
3) Replace with: listTwo.setItems(null);
4) Run HelloListView
5) Go to the 'DnD' tab
6) Drag an item from the left ListView to the right ListView
7) On my Windows 8 machine, I got the exception in the attached screenshot (sorry about the screenshot, for whatever reason IntelliJ was not allowing for copy/paste).
The reason why this occurs is obvious - in HelloListView there is the following code (note the comment):
EventHandler<DragEvent> dragDropped = new EventHandler<DragEvent>() {
public void handle(DragEvent event) {
ListView<String> list = (ListView) event.getGestureTarget();
Dragboard db = event.getDragboard();
boolean success = false;
if (db.hasString()) {
list.getItems().add(db.getString()); // <------- list.getItems() is null, so we're getting a NPE here.
success = true;
}
event.setDropCompleted(success);
event.consume();
}
};
Steps to reproduce:
1) Open the HelloListView class file.
2) Search for the line: listTwo.setItems(listTwoItems);
3) Replace with: listTwo.setItems(null);
4) Run HelloListView
5) Go to the 'DnD' tab
6) Drag an item from the left ListView to the right ListView
7) On my Windows 8 machine, I got the exception in the attached screenshot (sorry about the screenshot, for whatever reason IntelliJ was not allowing for copy/paste).
The reason why this occurs is obvious - in HelloListView there is the following code (note the comment):
EventHandler<DragEvent> dragDropped = new EventHandler<DragEvent>() {
public void handle(DragEvent event) {
ListView<String> list = (ListView) event.getGestureTarget();
Dragboard db = event.getDragboard();
boolean success = false;
if (db.hasString()) {
list.getItems().add(db.getString()); // <------- list.getItems() is null, so we're getting a NPE here.
success = true;
}
event.setDropCompleted(success);
event.consume();
}
};
- relates to
-
JDK-8093110 Unknown error 0x80DE0001 when trying to drag TreeView node
- Resolved