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

Ajit Ghaisas aghaisas at openjdk.java.net
Fri Sep 3 15:26:36 UTC 2021

On Thu, 26 Aug 2021 14:09:58 GMT, Jeanette Winzenburg <fastegal 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.

The fix looks good. 

Minor : Two comments from tests need to be removed.

modules/javafx.controls/src/test/java/test/javafx/scene/control/CellEditEventOfTableColumnTest.java line 179:

> 177: 
> 178:         ObservableList<String> model = FXCollections.observableArrayList("Four", "Five", "Fear");
> 179:             // "Flop", "Food", "Fizz"

Did you forget to remove this comment?

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?


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

More information about the openjfx-dev mailing list