RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE [v5]
Marius Hanl
mhanl at openjdk.org
Mon Sep 12 16:27:06 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");`
Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:
Do selection/focus logic after the null check
No need to prepare selection/focus stuff just to return later as one of them is null
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/711/files
- new: https://git.openjdk.org/jfx/pull/711/files/5f61fe0a..2cc2bd16
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=711&range=04
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=711&range=03-04
Stats: 29 lines in 2 files changed: 16 ins; 12 del; 1 mod
Patch: https://git.openjdk.org/jfx/pull/711.diff
Fetch: git fetch https://git.openjdk.org/jfx pull/711/head:pull/711
PR: https://git.openjdk.org/jfx/pull/711
More information about the openjfx-dev
mailing list