RFR: 8322750: Test "api/java_awt/interactive/SystemTrayTests.html" failed because A blue ball icon is added outside of the system tray [v2]

Alexander Zvegintsev azvegint at openjdk.org
Thu Feb 15 12:51:15 UTC 2024


On Thu, 15 Feb 2024 09:04:58 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   IllegalThreadStateException
>
> src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java line 307:
> 
>> 305:                  | InterruptedException
>> 306:                  | NumberFormatException ignored) {
>> 307:         }
> 
> seems `exitValue` can throw IllegalThreadStateException but it is not caught here..any reason or missed?

Thanks for catching this. Updated.

> src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java line 58:
> 
>> 56:         peerInstance = this;
>> 57: 
>> 58:         UNIXToolkit tk = (UNIXToolkit)Toolkit.getDefaultToolkit();
> 
> can we always cast to UNIXToolkit...shouldn't "instanceof" check be done here for SunToolkit or HeadlessToolkit instance, say?

It's already checked at this point.
SystemTray and its peers are only initialized in a non-headless environment.

see for `initializeSystemTrayIfNeeded()`:

https://github.com/openjdk/jdk/blob/a0e5e16afbd19f6396f0af2cba954225a357eca8/src/java.desktop/share/classes/java/awt/SystemTray.java#L173-175

https://github.com/openjdk/jdk/blob/a0e5e16afbd19f6396f0af2cba954225a357eca8/src/java.desktop/share/classes/java/awt/SystemTray.java#L218-221

> src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java line 94:
> 
>> 92:             return;
>> 93:         }
>> 94: 
> 
> What about `getTrayIconSize`?  Should we allow to return TRAY_ICON_HEIGHT/TRAY_ICON_WIDTH if disable system tray is on?

In the unsupported case, you don't have an instance to call this method.

https://github.com/openjdk/jdk/blob/a0e5e16afbd19f6396f0af2cba954225a357eca8/src/java.desktop/share/classes/java/awt/SystemTray.java#L179-182

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17860#discussion_r1490938221
PR Review Comment: https://git.openjdk.org/jdk/pull/17860#discussion_r1490947308
PR Review Comment: https://git.openjdk.org/jdk/pull/17860#discussion_r1490953562


More information about the client-libs-dev mailing list