RFR: 8089398: [ChoiceBox, ComboBox] throws NPE on setting value on null selectionModel

Marius Hanl mhanl at openjdk.java.net
Wed Jun 30 15:09:22 UTC 2021


This PR fixes 2 NPEs in Choice-and ComboBox, when the selection model is null.

ChoiceBox: 
- Null check in **valueProperty()** listener

ComboBox:
- Null check in **valueProperty()** listener
- Null check in **ComboBoxListViewSkin#updateValue()**

The tests checks, that no NPE is printed to the console (JUnit5 has the **assertDoesNotThrow​()** method, but 4 unfortunately has not). They also checks, that the set value is still displayed (either in the ComboBox button cell or the ChoiceBox display label)

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

Commit messages:
 - 8089398: [ChoiceBox, ComboBox] throws NPE on setting value on null selectionModel

Changes: https://git.openjdk.java.net/jfx/pull/557/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=557&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8089398
  Stats: 71 lines in 5 files changed: 62 ins; 3 del; 6 mod
  Patch: https://git.openjdk.java.net/jfx/pull/557.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/557/head:pull/557

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


More information about the openjfx-dev mailing list