RFR: JDK-8344907 : NullPointerException in Win32ShellFolder2.getSystemIcon when "icon" is null [v2]
Harshitha Onkar
honkar at openjdk.org
Tue Jan 7 20:33:50 UTC 2025
On Tue, 24 Dec 2024 12:56:14 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java line 1205:
>>
>>> 1203: Image icon = null;
>>> 1204: long hIcon = getSystemIcon(iconType.getIconID());
>>> 1205: if (hIcon != 0) {
>>
>> I suggest inverting the condition:
>>
>>
>> if (hIcon == 0) {
>> return null;
>> }
>>
>> Image icon = makeIcon(hIcon);
>>
>>
>> The code has less indentation and has better readability, in my opinion.
>
> Ah, I see the current style that you use follows the code style in `getShell32Icon`.
>
> Either go with the current style, or change the condition in `getShell32Icon` so that both methods use the same code flow.
@aivanov-jdk
Inverted hIcon condition and updated both the methods to match. Please re-review when you get a chance.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22776#discussion_r1906004459
More information about the client-libs-dev
mailing list