RFR: 8269871: CellEditEvent: must not throw NPE in accessors

Jeanette Winzenburg fastegal at openjdk.java.net
Sat Sep 4 08:46:49 UTC 2021


On Fri, 3 Sep 2021 15:00:32 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

>> The issue is unguarded access to tablePosition though it might be null (since [JDK-8120610](https://bugs.openjdk.java.net/browse/JDK-8120610)
>> 
>> The fix is to check against null in each accessor. Also required to fix the default onEditCommit handlers in Tree/TableColumn to really cope with null TablePostion on the event.
>> 
>> Added tests that failed/pass before/after the fix.
>> 
>> Note that there was an old test (in Tree/TableColumnTest each), that failed after the fix because it expected the NPE. Fixed by removing the expected parameter.
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/CellEditEventOfTreeTableColumnTest.java line 186:
> 
>> 184:         root.setExpanded(true);
>> 185:         ObservableList<String> model = FXCollections.observableArrayList("Four", "Five", "Fear");
>> 186:             // "Flop", "Food", "Fizz"
> 
> Did you forget to remove this comment?

yeah, pitfalls of c&p test boiler-plate code ;)

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

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


More information about the openjfx-dev mailing list