-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
jfx13
-
x86_64
-
linux_ubuntu
A DESCRIPTION OF THE PROBLEM :
While there are many places in ListViewBehavior that check if list's selection model is not null, there are still a couple of places that assume it exists. One of them is mousePressed method, triggered by clicking on cells, and another is activate, triggered by pressing either enter, space or f2 when list view has focus.
You can reproduce it by creating a list view, setting it's selection model to null and then clicking on it's items and pressing enter.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create an application with ListView without selection model:
2. Run it
3. Click on items in list view, or press Space, Enter or F2 with Listview in focus
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exceptions
ACTUAL -
null pointer exceptions
---------- BEGIN SOURCE ----------
public static class TestApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
ListView<String> listView = new ListView<>(FXCollections.observableArrayList("a", "b", "c"));
listView.setSelectionModel(null);
primaryStage.setScene(new Scene(listView));
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I can install custom event dispatcher on a list view that will prevent clicks and Space/Enter/F2 key presses from propagation
FREQUENCY : always
While there are many places in ListViewBehavior that check if list's selection model is not null, there are still a couple of places that assume it exists. One of them is mousePressed method, triggered by clicking on cells, and another is activate, triggered by pressing either enter, space or f2 when list view has focus.
You can reproduce it by creating a list view, setting it's selection model to null and then clicking on it's items and pressing enter.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create an application with ListView without selection model:
2. Run it
3. Click on items in list view, or press Space, Enter or F2 with Listview in focus
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no exceptions
ACTUAL -
null pointer exceptions
---------- BEGIN SOURCE ----------
public static class TestApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
ListView<String> listView = new ListView<>(FXCollections.observableArrayList("a", "b", "c"));
listView.setSelectionModel(null);
primaryStage.setScene(new Scene(listView));
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I can install custom event dispatcher on a list view that will prevent clicks and Space/Enter/F2 key presses from propagation
FREQUENCY : always
- duplicates
-
JDK-8279640 ListView with null SelectionModel/FocusModel throws NPE
- Resolved
- relates to
-
JDK-8090060 TableView with null selectionModel throws NPE on sorting
- Closed
- links to
-
Review openjdk/jfx/711