Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8267392: ENTER key press on editable TableView throws NPE #505

Closed

Conversation

@Maran23
Copy link
Member

@Maran23 Maran23 commented May 19, 2021

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.
EDIT: Changed the title. :)

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8267392: ENTER key press on editable TableView throws NPE

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/505/head:pull/505
$ git checkout pull/505

Update a local copy of the PR:
$ git checkout pull/505
$ git pull https://git.openjdk.java.net/jfx pull/505/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 505

View PR using the GUI difftool:
$ git pr show -t 505

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/505.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 19, 2021

👋 Welcome back Maran23! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@kleopatra
Copy link
Collaborator

@kleopatra kleopatra commented May 19, 2021

sounds like a duplicate of JDK-8089652 - faintly remember that it's a dark pit: there are issues in selection/focus model implementations, see f.i. JDK-8219720. Starting with fixing the NPE is goood :))

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented May 19, 2021

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

Copy link
Member

@kevinrushforth kevinrushforth left a comment

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).

@kevinrushforth kevinrushforth requested a review from aghaisas May 19, 2021
@Maran23 Maran23 changed the title TBD: Fixed NP when ENTER is pressed on an editable table 8267392: ENTER key press on editable TableView throws NPE May 19, 2021
@openjdk openjdk bot added the rfr label May 19, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 19, 2021

Webrevs

@Maran23
Copy link
Member Author

@Maran23 Maran23 commented May 19, 2021

sounds like a duplicate of JDK-8089652 - faintly remember that it's a dark pit: there are issues in selection/focus model implementations, see f.i. JDK-8219720. Starting with fixing the NPE is goood :))

Should I add this issue to this PR then? I'm not sure, as with my fix, ENTER won't start editing the cell still. This is due the whole row is initially focused, not a particular cell (getFocusModel().focus(row) -> no table column will be set inside the focused cell table position).
The only difference you will see, when pressing ENTER, is a change from the focused state (this light blue border) to the selected state (row is highlighted blue) and of course no NPE inside the console. 😃

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented May 19, 2021

sounds like a duplicate of JDK-8089652 - faintly remember that it's a dark pit: there are issues in selection/focus model implementations, see f.i. JDK-8219720. Starting with fixing the NPE is goood :))

Should I add this issue to this PR then? I'm not sure, as with my fix, ENTER won't start editing the cell still.

No. While this fixes the NPE noted in JDK-8089652, it doesn't fix all of the problems described in that bug.

Copy link
Collaborator

@kleopatra kleopatra left a comment

Fix looks good - verified that the new tests fail before and pass after

@aghaisas
Copy link
Collaborator

@aghaisas aghaisas commented May 21, 2021

/reviewers 2

@openjdk
Copy link

@openjdk openjdk bot commented May 21, 2021

@Maran23 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8267392: ENTER key press on editable TableView throws NPE

Reviewed-by: fastegal, aghaisas

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 1 new commit pushed to the master branch:

  • 111bac4: 8263760: Update gradle to version 7.0.1

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @kleopatra, @aghaisas) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label May 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 21, 2021

@aghaisas
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@Maran23
Copy link
Member Author

@Maran23 Maran23 commented May 21, 2021

/integrate

@openjdk openjdk bot added the sponsor label May 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 21, 2021

@Maran23
Your change (at version 89e65cc) is now ready to be sponsored by a Committer.

@aghaisas
Copy link
Collaborator

@aghaisas aghaisas commented May 21, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented May 21, 2021

@aghaisas @Maran23 Since your change was applied there has been 1 commit pushed to the master branch:

  • 111bac4: 8263760: Update gradle to version 7.0.1

Your commit was automatically rebased without conflicts.

Pushed as commit 5843910.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Maran23 Maran23 deleted the np-on-enter-inside-editable-table branch Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants