On Wed, 19 May 2021 00:48:18 GMT, Marius Hanl 
<github.com+66004280+mara...@openjdk.org> wrote:

> **Note: I reported the bug already, waiting for approval. Internal tracking 
> id: 9070318. I will update the title as soon as the ticket is created.**
> 
> This PR is fixing a NP, which is thrown when you press ENTER on an editbale 
> table, after it is initially shown.
> 
> When pressing ENTER, **TableViewBehaviorBase#activate** is retrieving the 
> current focused row (**getFocusedCell()**) and from there the corresponding 
> table column.
> This is null, when a table is initially shown. It can also be null, when the 
> items from the underlying table are changed (e.g. **setItems()**) or when 
> **getFocusModel().focus(row)** is used. 
> Therefore, null is a valid value and we should guard against it.

The fix looks simple and safe enough. I'll let @aghaisas and @kleopatra review 
it. I left one naming comment, which also applies to the PR title (I already 
updated the JBS bug title).

The bug has been transferred to JDK project: 
https://bugs.openjdk.java.net/browse/JDK-8267392

modules/javafx.controls/src/test/java/test/javafx/scene/control/TableViewKeyInputTest.java
 line 196:

> 194: 
> 195:     @Test
> 196:     public void testEnterOnFocusedRowDoesNotThrowNP() {

The usual abbreviation for NullPointerException is `NPE` rather than `NP`, so I 
recommend updating the test method names and comments accordingly.

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

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

Reply via email to