RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE [v5]

Jeanette Winzenburg fastegal at openjdk.org
Wed Sep 14 12:29:05 UTC 2022


On Mon, 12 Sep 2022 16:27:06 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> 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

left a comment - which is only tangentially related to the issue to fix here. 

So this looks good. Cool tests for the code in the accessibility block, my learn item of the day :))

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

Marked as reviewed by fastegal (Reviewer).

PR: https://git.openjdk.org/jfx/pull/711


More information about the openjfx-dev mailing list