RFR: 8322239: [macos] a11y : java.lang.NullPointerException is thrown when focus is moved on the JTabbedPane [v4]

Alexander Zuev kizune at openjdk.org
Thu Feb 15 17:46:09 UTC 2024


On Wed, 14 Feb 2024 20:06:54 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Moved frame disposal to the EDT
>
> test/jdk/javax/swing/JTabbedPane/TabbedPaneNPECheck.java line 90:
> 
>> 88:             if (accessible instanceof AccessibleComponent) {
>> 89:                 try {
>> 90:                     AccessibleComponent component = (AccessibleComponent) accessible;
> 
> You can you pattern matching if you like:
> Suggestion:
> 
>             if (accessible instanceof AccessibleComponent component) {
>                 try {

Since this fix can be backported to the previous releases where this nice feature is not available i prefer not to use it. I guess backporting is why we can't get nice things for ourselves.

> test/jdk/javax/swing/JTabbedPane/TabbedPaneNPECheck.java line 93:
> 
>> 91:                     Point p = component.getLocationOnScreen();
>> 92:                     Rectangle r = component.getBounds();
>> 93:                 } catch (NullPointerException npe){
> 
> Suggestion:
> 
>                 } catch (NullPointerException npe) {
> 
> Missing space.

Done

> test/jdk/javax/swing/JTabbedPane/TabbedPaneNPECheck.java line 95:
> 
>> 93:                 } catch (NullPointerException npe){
>> 94:                     throw new RuntimeException("Unexpected NullPointerException " +
>> 95:                             "while getting accessible component bounds: " + npe);
> 
> Suggestion:
> 
>                     throw new RuntimeException("Unexpected NullPointerException " +
>                             "while getting accessible component bounds", npe);
> 
> Preserve the full context of NPE for analysing the failure if it ever occurs.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17736#discussion_r1491391622
PR Review Comment: https://git.openjdk.org/jdk/pull/17736#discussion_r1491390232
PR Review Comment: https://git.openjdk.org/jdk/pull/17736#discussion_r1491388109


More information about the client-libs-dev mailing list