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

4819544: SwingSet2 JTable Demo throws NullPointerException #4969

Closed
wants to merge 3 commits into from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Aug 3, 2021

In the JTable demo, if we double click on the first cell in the Favorite Number column, delete the value and click on some
other cell, a java.lang.NullPointerException is getting thrown.
The flaw is in the TableDemo's TableModel getColumnClass() method which queries the value of cell 0 in the target column, and returns its Class. This logic seems to be flawed - an NPE will be thrown when the value in cell 0 is null.
Fix by checking for null.


Progress

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

Issue

  • JDK-4819544: SwingSet2 JTable Demo throws NullPointerException

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4969

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Aug 3, 2021

👋 Welcome back psadhukhan! 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.

@openjdk openjdk bot added the rfr label Aug 3, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 3, 2021

@prsadhuk The following label will be automatically applied to this pull request:

  • swing

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the swing label Aug 3, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Aug 3, 2021

Webrevs

Copy link

@pankaj-bansal pankaj-bansal left a comment

Verified that the NPE is not happening after the fix.

@openjdk
Copy link

@openjdk openjdk bot commented Aug 4, 2021

@prsadhuk 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:

4819544: SwingSet2 JTable Demo throws NullPointerException

Reviewed-by: pbansal, aivanov

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 134 new commits pushed to the master branch:

  • 6c8441f: 8271878: UnProblemList jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java in JDK18
  • 7728423: 8271895: UnProblemList javax/swing/JComponent/7154030/bug7154030.java in JDK18
  • cd6b54e: Merge
  • cebcc07: 8271894: ProblemList javax/swing/JComponent/7154030/bug7154030.java in JDK17
  • 5f547e8: 8271877: ProblemList jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java in JDK17
  • 181483b: 8271064: ZGC several jvm08 perf regressions after JDK-8268372
  • a007cb1: 8271863: ProblemList serviceability/sa/TestJmapCore.java on linux-x64 with ZGC
  • d62fbea: 8271898: disable os.release_multi_mappings_vm on macOS-X64
  • 359c708: 8271893: mark hotspot runtime/PerfMemDestroy/PerfMemDestroy.java test as ignoring external VM flags
  • a3b0143: 8271887: mark hotspot runtime/CDSCompressedKPtrs tests which ignore external VM flags
  • ... and 124 more: https://git.openjdk.java.net/jdk/compare/e4295ccfcdb16041d6f18fd64f7df3f740bf258f...master

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.

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

@openjdk openjdk bot added the ready label Aug 4, 2021
if (obj != null) {
return obj.getClass();
}
return Object.class;
Copy link
Member

@aivanov-jdk aivanov-jdk Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall the ternary conditional operator be used here?

Suggested change
if (obj != null) {
return obj.getClass();
}
return Object.class;
return obj != null ? obj.getClass() : Object.class;

@prsadhuk
Copy link
Contributor Author

@prsadhuk prsadhuk commented Aug 5, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

Going to push as commit 64d18d4.
Since your change was applied there have been 134 commits pushed to the master branch:

  • 6c8441f: 8271878: UnProblemList jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java in JDK18
  • 7728423: 8271895: UnProblemList javax/swing/JComponent/7154030/bug7154030.java in JDK18
  • cd6b54e: Merge
  • cebcc07: 8271894: ProblemList javax/swing/JComponent/7154030/bug7154030.java in JDK17
  • 5f547e8: 8271877: ProblemList jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java in JDK17
  • 181483b: 8271064: ZGC several jvm08 perf regressions after JDK-8268372
  • a007cb1: 8271863: ProblemList serviceability/sa/TestJmapCore.java on linux-x64 with ZGC
  • d62fbea: 8271898: disable os.release_multi_mappings_vm on macOS-X64
  • 359c708: 8271893: mark hotspot runtime/PerfMemDestroy/PerfMemDestroy.java test as ignoring external VM flags
  • a3b0143: 8271887: mark hotspot runtime/CDSCompressedKPtrs tests which ignore external VM flags
  • ... and 124 more: https://git.openjdk.java.net/jdk/compare/e4295ccfcdb16041d6f18fd64f7df3f740bf258f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 5, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Aug 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 5, 2021

@prsadhuk Pushed as commit 64d18d4.

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

@prsadhuk prsadhuk deleted the 4819544 branch Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated swing
3 participants