RFR: 8300084: AquaFileChooserUI.getDefaultButton returns null

Alexey Ivanov aivanov at openjdk.org
Mon Jan 16 11:43:21 UTC 2023


On Mon, 16 Jan 2023 11:17:10 GMT, Tejesh R <tr at openjdk.org> wrote:

> In Aqua look and feel, `getDefaultButton()` of `JFileChooser` returns null. The fix overrides the method from `FileChooserUI` to return the `ApproveButton` of `FileChooser` which is similar to other L&F. 
> The test is run for multiple iterations in CI machine.

Looks good to me.

I doubt a separate test for this issue is worth it. This case is entirely covered by the test in #11901 for [JDK-8299522](https://bugs.openjdk.org/browse/JDK-8299522), which also ensures the button text isn't empty.

Adding 8300084 to the `@bug` tag in that test is enough. It was my [original suggestion](https://github.com/openjdk/jdk/pull/11901#discussion_r1068659255):

> Now you can fix this bug so that Aqua L&F doesn't return null and add that bugid to this test.

test/jdk/javax/swing/JFileChooser/AquaDefaultButtonTest.java line 48:

> 46:                 if (defaultApproveButton == null) {
> 47:                     throw new RuntimeException("getDefaultButton() method returns null for Aqua L&F!");
> 48:                 }

If you choose shorter names for variables, the line would fit into 80-column limit. Now the two lines are nearly 100 characters long, though not a big issue.

-------------

Marked as reviewed by aivanov (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12008



More information about the client-libs-dev mailing list