RFR: JDK-8344907 : NullPointerException in Win32ShellFolder2.getSystemIcon when "icon" is null [v2]

Alexey Ivanov aivanov at openjdk.org
Tue Dec 24 12:59:40 UTC 2024


On Tue, 24 Dec 2024 12:29:39 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   hIcon check added
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22776#discussion_r1896730654


More information about the client-libs-dev mailing list