-
Bug
-
Resolution: Fixed
-
P4
-
None
Failing test (same for TreeTablePosition):
@Test
public void testNullTable() {
new TablePosition<>(null, 2, new TableColumn<>());
}
As null handling is not spec'ed in the constructor's doc, options to fix would be
- change the doc to explicitly disallow null
- fix the implementation to not throw
My take is clearly the latter (in no particular order):
- a position might be used unrelated to a specific table: used to mark f.i. a particular cell in any table
- users are warned to expect a null (f.i. in doc of constructor and getColumn), so formally supporting it wouldn't make a difference to client code
- the NPE (for TableView) is introduced inJDK-8093105, looks like it happend accidentally when supporting access to the underlying row object
blowing code:
List<S> items = tableView.getItems();
fix to
List<S> items = tableView != null ? tableView.getItems() : null;
@Test
public void testNullTable() {
new TablePosition<>(null, 2, new TableColumn<>());
}
As null handling is not spec'ed in the constructor's doc, options to fix would be
- change the doc to explicitly disallow null
- fix the implementation to not throw
My take is clearly the latter (in no particular order):
- a position might be used unrelated to a specific table: used to mark f.i. a particular cell in any table
- users are warned to expect a null (f.i. in doc of constructor and getColumn), so formally supporting it wouldn't make a difference to client code
- the NPE (for TableView) is introduced in
blowing code:
List<S> items = tableView.getItems();
fix to
List<S> items = tableView != null ? tableView.getItems() : null;
- blocks
-
JDK-8187229 Tree/TableCell: cancel event must return correct editing location
- Resolved
- links to
-
Commit openjdk/jfx/47c2ec3d