On Fri, 17 Apr 2026 19:40:12 GMT, Jeremy Wood <[email protected]> wrote:

>> This adds a null check in case SwingUtilities.getWindowAncestor is null.
>> 
>> Although I developed a jtreg test in the original ticket write-up for 
>> 8382396, I later realized I can just ask the preexisting test for 
>> JDK-8170794 to run with different VM options to help test this issue.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jeremy Wood has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Apply suggestion from @aivanov-jdk
>   
>   Co-authored-by: Alexey Ivanov <[email protected]>

The tests are green.

I also reproduced the NPE on macOS without the fix; it doesn't reproduce on 
Windows.

test/jdk/javax/swing/JDesktopPane/TestDesktopManagerNPE.java line 44:

> 42: import javax.swing.JMenuBar;
> 43: import javax.swing.KeyStroke;
> 44: import javax.swing.SwingUtilities;

Suggestion:

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

While you're still editing the file, you may clean up the unused imports… if 
you wish.

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

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30783#pullrequestreview-4140012579
PR Review Comment: https://git.openjdk.org/jdk/pull/30783#discussion_r3110678901

Reply via email to