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

8241710: NullPointerException while entering empty submenu with "arrow right" #161

Closed
wants to merge 2 commits into from

Conversation

@aghaisas
Copy link
Collaborator

@aghaisas aghaisas commented Apr 7, 2020

Bug : https://bugs.openjdk.java.net/browse/JDK-8241710

Root Cause : A menu can have empty submenu. This was not checked while processing RIGHT arrow key.

Fix : Added the null check for submenu. Added a unit test case which fails without fix and passes with it.


Progress

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

Issue

  • JDK-8241710: NullPointerException while entering empty submenu with "arrow right"

Reviewers

  • Jeanette Winzenburg (fastegal - Author)
  • Kevin Rushforth (kcr - Reviewer)

Download

$ git fetch https://git.openjdk.java.net/jfx pull/161/head:pull/161
$ git checkout pull/161

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 7, 2020

👋 Welcome back aghaisas! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request.

@openjdk openjdk bot added the rfr label Apr 7, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 7, 2020

Webrevs

Copy link
Collaborator

@kleopatra kleopatra left a comment

Verified the fix: test is failing before and passing after.

See one inline comment (just noting my personal pref :).

And again me fighting the system (can't seem to review code parts that are not near a change, so doing here:

  • copyright year doesn't seem to be updated

  • there's another fishy looking code line in MenuItemContainer actionHandler:

    actionEventHandler = e -> {
         if (item instanceof Menu) {
               final Menu menu = (Menu) item;
               if (openSubmenu == menu && submenu.isShowing()) return;
    

don't know when/if that's ever reached (could get there - an action handler on the region itself?), anyway, at other places with a similar pattern (f.i processRightKey) there's an explicit guard against a null submenu, don't know if the latter is over-caution - logic and code is rather .. well .. inter-twined ;)

Copy link
Collaborator Author

@aghaisas aghaisas left a comment

Verified the fix: test is failing before and passing after.

Thanks for the quick test.

See one inline comment (just noting my personal pref :).

And again me fighting the system (can't seem to review code parts that are not near a change, so doing here:

Well, you are part of the system :)

* copyright year doesn't seem to be updated

I have updated this now.

* there's another fishy looking code line in MenuItemContainer actionHandler:
  ```
  actionEventHandler = e -> {
       if (item instanceof Menu) {
             final Menu menu = (Menu) item;
             if (openSubmenu == menu && submenu.isShowing()) return;
  ```

don't know when/if that's ever reached (could get there - an action handler on the region itself?), anyway, at other places with a similar pattern (f.i processRightKey) there's an explicit guard against a null submenu, don't know if the latter is over-caution - logic and code is rather .. well .. inter-twined ;)

Yes. This code does not seem to be ideal, but, it has evolved and a lot of fixes have gone in. So rewriting is ruled out.

Copy link
Collaborator

@kleopatra kleopatra left a comment

okay, thanks for the quicks changes :)

@openjdk
Copy link

@openjdk openjdk bot commented Apr 7, 2020

@aghaisas This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

8241710: NullPointerException while entering empty submenu with "arrow right"

Reviewed-by: fastegal, kcr
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 7 commits pushed to the master branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate 231879a61137fd3d9f26daa4d308d69e6f8afba1.

➡️ To integrate this PR with the above commit message, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 7, 2020
@aghaisas
Copy link
Collaborator Author

@aghaisas aghaisas commented Apr 8, 2020

/integrate

@openjdk openjdk bot closed this Apr 8, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 8, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Apr 8, 2020

@aghaisas The following commits have been pushed to master since your change was applied:

  • 470c7d0: 8230809: HTMLEditor formatting lost when selecting all (CTRL-A)
  • fda015c: 8242167: ios keyboard handling
  • 844460b: 8242163: Android keyboard integration fails
  • 364c64a: 8241249: NPE in TabPaneSkin.perfromDrag
  • 418675a: 8236840: Memory leak when switching ButtonSkin
  • 247a65d: 8236971: [macos] Gestures handled incorrectly due to missing events

Your commit was automatically rebased without conflicts.

Pushed as commit 231879a.

@aghaisas aghaisas deleted the aghaisas:contextMenu_NPE_fix branch Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants