Skip to content

8388485: javax/swing/JInternalFrame/Test6505027.java fails with Cannot invoke "Object.getClass()" because "<local0>" is null - #32019

Closed
prsadhuk wants to merge 2 commits into
openjdk:masterfrom
prsadhuk:JDK-8388485
Closed

8388485: javax/swing/JInternalFrame/Test6505027.java fails with Cannot invoke "Object.getClass()" because "<local0>" is null#32019
prsadhuk wants to merge 2 commits into
openjdk:masterfrom
prsadhuk:JDK-8388485

Conversation

@prsadhuk

@prsadhuk prsadhuk commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Test fails with NPE citing

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "<local0>" is null
at Test6505027.validate(Test6505027.java:108)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:583)
at SwingTest.run(SwingTest.java:96)
at SwingTest.start(SwingTest.java:131)
at SwingTest.start(SwingTest.java:54)
at Test6505027.main(Test6505027.java:67) 

which can happen when the internal frame has not received native focus yet, or the Robot click’s focus transfer has not completed. The test validates focus owner immediately after clicking cell (1,1).
Robot waitForIdle and delay is added after cell click to give time before current focus owner check is called.
Also, explicitly activated the internal frame after it has been added to the desktop pane:
Also, instanceof check is used instead of component.getClass().equals(JComboBox.class) because it handles null cleanly and does not reject a valid subclass

Additionally, press() and validate() was called in separate EDT and main thread respectively which can cause issues like this, so made sure they are called in same thread as SwingTest calls static methods in main thread.

Recurrent CI test execution is found to be ok.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8388485: javax/swing/JInternalFrame/Test6505027.java fails with Cannot invoke "Object.getClass()" because "<local0>" is null (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/32019/head:pull/32019
$ git checkout pull/32019

Update a local copy of the PR:
$ git checkout pull/32019
$ git pull https://git.openjdk.org/jdk.git pull/32019/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 32019

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/32019.diff

Using Webrev

Link to Webrev Comment

…t invoke Object.getClass() because <local0> is null
@bridgekeeper

bridgekeeper Bot commented Jul 23, 2026

Copy link
Copy Markdown

👋 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 commented Jul 23, 2026

Copy link
Copy Markdown

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

8388485: javax/swing/JInternalFrame/Test6505027.java fails with Cannot invoke "Object.getClass()" because "<local0>" is null

Reviewed-by: prr, serb

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 30 new commits pushed to 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.

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

@openjdk openjdk Bot added the client client-libs-dev@openjdk.org label Jul 23, 2026
@openjdk

openjdk Bot commented Jul 23, 2026

Copy link
Copy Markdown

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

  • client

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 commented Jul 23, 2026

Copy link
Copy Markdown

The total number of required reviews for this PR has been set to 2 based on the presence of this label: client. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jul 23, 2026
@mlbridge

mlbridge Bot commented Jul 23, 2026

Copy link
Copy Markdown

Webrevs

try {
frame.setSelected(true);
} catch (PropertyVetoException ex) {
throw new Error("could not select internal frame", ex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we please use RuntimeException instead of Error - here and elsewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since it was already using Error I used that to have consistency..Anyway, updated to use RTE

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Jul 28, 2026
@prsadhuk

Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk

openjdk Bot commented Jul 28, 2026

Copy link
Copy Markdown

Going to push as commit 410a952.
Since your change was applied there have been 30 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Jul 28, 2026
@openjdk openjdk Bot closed this Jul 28, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 28, 2026
@prsadhuk
prsadhuk deleted the JDK-8388485 branch July 28, 2026 01:23
@openjdk

openjdk Bot commented Jul 28, 2026

Copy link
Copy Markdown

@prsadhuk Pushed as commit 410a952.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants