RFR: 8159055: Clarify handling of null and invalid image data for ImageIcon constructors and setImage method [v25]

Alexey Ivanov aivanov at openjdk.org
Tue Aug 5 13:42:21 UTC 2025


On Tue, 5 Aug 2025 11:19:41 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   class javadoc modification
>
> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 71:
> 
>> 69:  * even though {@link #getImage()} will return a non-null value,
>> 70:  * as the image will have no dimensions
>> 71:  * and {@link #getImageLoadStatus()} will report {@code MediaTracker.ERRORED}.
> 
> What do you think about this version?
> Suggestion:
> 
>  * If the image source parameter provided to a constructor or method is non-{@code null}
>  * but does not reference valid or accessible image data, no exceptions will be thrown.
>  * In this case, {@link #getImage()} will return a non-{@code null} value, but the image
>  * will have no dimensions, and nothing will be rendered.
>  * Additionally, {@link #getImageLoadStatus()} will report {@code MediaTracker.ERRORED}.
> 
> Shorter sentences are easier to read, the statements are clearer.

@prrace What do you say about the above suggestion?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2254382619


More information about the client-libs-dev mailing list