-
Bug
-
Resolution: Fixed
-
P4
-
jfx16
in commit/cancelEdit:
if (table != null)
// create and fire edit event
in startEdit:
if (column != null)
// create and fire edit event
digging into history: for cancel, the current pattern (null check of table) was added withJDK-8116392: before it checked column for null
failing test:
@Test
public void testEditCancelNoColumn() {
table.setEditable(true);
cell.updateTableView(table);
// force artificially not-empty cell state
TableCellShim.set_lockItemOnEdit(cell, true);
CellShim.updateItem(cell, "something", false);
// start edit: succeeds without firing event (null check
against column)
cell.startEdit();
assertTrue(cell.isEditing());
// cancel edit: NPE from Event.fire - all params
must be != null
cell.cancelEdit();
assertFalse(cell.isEditing());
}
notes:
- the event is fired on the column as target, so the column must not be null
- without guarding against null table, throws NPE due toJDK-8269871 (CellEditEvent is incorrectly? implemented to require !null table)
- same pattern in TreeTableCell which looks like c&p'ed from TableCell
see also: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-July/031106.html
if (table != null)
// create and fire edit event
in startEdit:
if (column != null)
// create and fire edit event
digging into history: for cancel, the current pattern (null check of table) was added with
failing test:
@Test
public void testEditCancelNoColumn() {
table.setEditable(true);
cell.updateTableView(table);
// force artificially not-empty cell state
TableCellShim.set_lockItemOnEdit(cell, true);
CellShim.updateItem(cell, "something", false);
// start edit: succeeds without firing event (null check
against column)
cell.startEdit();
assertTrue(cell.isEditing());
// cancel edit: NPE from Event.fire - all params
must be != null
cell.cancelEdit();
assertFalse(cell.isEditing());
}
notes:
- the event is fired on the column as target, so the column must not be null
- without guarding against null table, throws NPE due to
- same pattern in TreeTableCell which looks like c&p'ed from TableCell
see also: https://mail.openjdk.java.net/pipermail/openjfx-dev/2021-July/031106.html
- relates to
-
JDK-8269871 CellEditEvent: must not throw NPE in accessors
- Resolved