RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

Marius Hanl mhanl at openjdk.java.net
Sat Jan 8 00:22:45 UTC 2022


This PR fixes a bunch of NPEs when a null `SelectionModel` or `FocusModel` is set on a `ListView`.

The following NPEs are fixed (all are also covered by exactly one test case):
NPEs with null selection model:
- Mouse click on a `ListCell`
- SPACE key press
- KP_UP (arrow up) key press
- HOME key press
- END key press
- BACK_SLASH + CTRL key press

NPEs with null focus model:
- SPACE key press
- Select an items: getSelectionModel().select(1)
- Clear-Select an item and add one after: listView.getSelectionModel().clearAndSelect(1); listView.getItems().add("3");

-------------

Commit messages:
 - 8279640: ListView with null SelectionModel/FocusModel throws NPE

Changes: https://git.openjdk.java.net/jfx/pull/711/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=711&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8279640
  Stats: 145 lines in 4 files changed: 130 ins; 2 del; 13 mod
  Patch: https://git.openjdk.java.net/jfx/pull/711.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/711/head:pull/711

PR: https://git.openjdk.java.net/jfx/pull/711


More information about the openjfx-dev mailing list