RFR: 8159055: ImageIcon setImage and constructor can't handle null parameter [v5]

Sergey Bylokhov serb at openjdk.org
Wed Jun 18 03:34:30 UTC 2025


On Mon, 16 Jun 2025 15:18:34 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 224:
>> 
>>> 222:      * @see java.awt.Image#getProperty
>>> 223:      */
>>> 224:     public ImageIcon (Image image) {
>> 
>> Does it make sense to expand the javadoc for all the constructors to specify how `null` is handled?
>
> I have expanded for those methods where there is code change for NULL interception....Not sure about others..

Note that "ImageIcon(URL location)" will throw npe as well, do we want to ignore it or specify NPE? That is actually interesting question since initially some of methods throw NPE and another ignore the image.

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

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


More information about the client-libs-dev mailing list