Skip to content

Conversation

@honkar-jdk
Copy link
Contributor

@honkar-jdk honkar-jdk commented Nov 6, 2025

/javax/swing/JFileChooser/bug4759934.java test changes related to addition of new method to Util - #27944.


Progress

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

Issue

  • JDK-8371365: Update javax/swing/JFileChooser/bug4759934.java to use Util.findComponent() (Task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28169

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 6, 2025

👋 Welcome back honkar! 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
Copy link

openjdk bot commented Nov 6, 2025

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

8371365: Update javax/swing/JFileChooser/bug4759934.java to use Util.findComponent()

Reviewed-by: aivanov, dnguyen, azvegint

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

@honkar-jdk
Copy link
Contributor Author

@aivanov-jdk @TejeshR13 Please review

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Nov 6, 2025
@openjdk
Copy link

openjdk bot commented Nov 6, 2025

@honkar-jdk 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 added the rfr Pull request is ready for review label Nov 6, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 6, 2025

Webrevs

@@ -72,8 +74,10 @@ public static void main(String[] args) throws Exception {
robot.mouseRelease(MouseEvent.BUTTON1_DOWN_MASK);
Copy link
Member

Choose a reason for hiding this comment

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

#27944 (comment)

All the clicks above are to click a button… Should we replace these clicks with programmatic clicks?

This is more reliable and quicker than robot.

The only possible issue is to to ensure the updated test still reproduces the original bug.

Copy link
Member

Choose a reason for hiding this comment

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

I just noticed your comment: #27944 (comment)

I'm for keeping the other clicks as-is (via Robot) since we have reference to these buttons unlike the cancel button of JFileChooser and this way keep much of the original test case intact without overly modifying it.

“…Since we have reference to these buttons,” it's even easier to call frameBtn.doClick() and dlgBtnLoc.doClick().

Once you get the reference to the Cancel button in the file chooser you can also use robot to click the button.

Using consistently the same method to click the buttons makes the test easier to comprehend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I referred to the original JBS issue for which this test was created - JDK-4759934. Looks like we can use doClick() instead of using Robot for the clicks.

But the problem is that when we use doClick() for frameBtn and dialogBtn, JFC's click on Cancel button doesn't happen and the test fails due to timeout. This happens on macOS26, I have to test on other platforms.

            SwingUtilities.invokeAndWait(() -> frameBtn.doClick());
            robot.waitForIdle();
            robot.delay(500);

            SwingUtilities.invokeAndWait(() -> dialogBtn.doClick());
            robot.waitForIdle();
            robot.delay(500);

            SwingUtilities.invokeAndWait(() -> {
                JButton cancelBtn = findCancelButton(jfc);
                cancelBtn.doClick();
            });
            robot.delay(500);

Copy link
Member

Choose a reason for hiding this comment

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

I see… It may be not worth the effort then.

However, this behaviour — clicking the Cancel button doesn't happen — could be a bug.

Why does the test time out? Even if clicking the Cancel button didn't work, the test should finish with a failure.

Copy link
Contributor Author

@honkar-jdk honkar-jdk Nov 7, 2025

Choose a reason for hiding this comment

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

I believe the test hangs after - dialogBtn.doClick() and does not proceed to the test condition check. I'll need to check in depth as to why this is happening.

I see… It may be not worth the effort then.

I can create a separate JBS issue to look into it and as for the test changes use the doClick() for just the JFC's Cancel button. Does this sound good to you?

Copy link
Member

Choose a reason for hiding this comment

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

Does this sound good to you?

This is likely the best approach.

It's a new problem that we discovered. It doesn't prevent integrating the change to search for the Cancel button in the file chooser, yet it would be good to investigate what goes wrong when all the buttons are clicked programmatically instead of using the robot to generate mouse clicks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a new JBS to track the doClick() issue - JDK-8371728

@honkar-jdk honkar-jdk changed the title JDK-8371365 : Update /javax/swing/JFileChooser/bug4759934.java to use Util.findComponent() JDK-8371365 : Update javax/swing/JFileChooser/bug4759934.java to use Util.findComponent() Nov 7, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 7, 2025
Copy link
Contributor

@DamonGuy DamonGuy left a comment

Choose a reason for hiding this comment

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

LGTM. Seems like this will be more consistent and reads better. Tested and passes.

@honkar-jdk
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 12, 2025

Going to push as commit 78db38f.
Since your change was applied there have been 50 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 Nov 12, 2025
@openjdk openjdk bot closed this Nov 12, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 12, 2025
@openjdk
Copy link

openjdk bot commented Nov 12, 2025

@honkar-jdk Pushed as commit 78db38f.

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

4 participants