RFR: 8089398: [ChoiceBox, ComboBox] throws NPE on setting value on null selectionModel
Marius Hanl
mhanl at openjdk.java.net
Thu Jul 1 15:13:06 UTC 2021
On Thu, 1 Jul 2021 14:52:28 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:
>> 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. They also checks, that the set value is still displayed (either in the ComboBox button cell or the ChoiceBox display label)
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/ChoiceBoxTest.java line 162:
>
>> 160: ByteArrayOutputStream out = new ByteArrayOutputStream();
>> 161: System.setErr(new PrintStream(out, true));
>> 162:
>
> hmm .. this looks a bit unusual. I suspect you want to somehow get around not receiving errors when property changes are involved - if so, the way we typically handle it is to install an uncaughtExceptionHandler to make them appear in the tests (see f.i. ListCellTest). Might have a reason I don't see, though - if so, which?
Ahh, now I understand this. I saw that in one test class but was not sure what it does. I will have a look later on this.
-------------
PR: https://git.openjdk.java.net/jfx/pull/557
More information about the openjfx-dev
mailing list