RFR: 8159055: ImageIcon.setImage can't handle null parameter [v18]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jul 25 03:36:45 UTC 2025
On Thu, 24 Jul 2025 19:36:00 GMT, Phil Race <prr at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove unneeded vars
>
> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 64:
>
>> 62: * are preloaded using MediaTracker to monitor the loaded state
>> 63: * of the image.
>> 64: * If the image source parameter to a constructor is non-null,
>
> Whilst reviewing the CSR I realized you need to change the line above to say
> "If the image source parameter to a constructor or method is non-null,"
>
> I made that change in the CSR. Do it here too. It is needed to cover setImage()
Added
> test/jdk/javax/swing/ImageIcon/ImageIconTest.java line 103:
>
>> 101: passed = true;
>> 102: }
>> 103: } catch (Exception ex) {
>
> What's this block for ? What other kind of exception besides NPE can we get ?
I added this to handle if "invalid data" handling causes the code to throw IOException or something like that..
But anyways removed now..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2230061559
PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2230061369
More information about the client-libs-dev
mailing list