On Fri, 27 Mar 2026 21:56:44 GMT, Philemon Hilscher <[email protected]> wrote:
>> Philemon Hilscher has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8222454: Review fixes >> >> Signed-off-by: Philemon Hilscher <[email protected]> > > modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TableCellBehaviorBase.java > line 103: > >> 101: final C tableCell = getNode(); >> 102: >> 103: int count = getItemCount(); > > Moved up to check it earlier on here we need to check whether the cell is empty, because getItemCount() does not check for null. here is the reproducer, click on an empty row: package goryachev.bugs; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; // NPE scenario for PR2129 public class TableView_NPE_Test extends Application { private TableView<String> table; private final ObservableList<String> data = FXCollections.observableArrayList("A"); @Override public void start(Stage stage) { table = new TableView<>(data); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY_SUBSEQUENT_COLUMNS); TableColumn<String, String> col = new TableColumn<>("Column 1"); col.setCellValueFactory((f) -> { return new SimpleStringProperty(f.getValue()); }); col.setCellFactory((tp) -> { TableCell<String,String> cell = new TableCell<>(); cell.addEventFilter(MouseEvent.MOUSE_PRESSED, (ev) -> { table.setItems(null); }); return cell; }); table.getColumns().add(col); stage.setScene(new Scene(table, 500, 500)); stage.show(); } } ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2129#discussion_r4019198147
