On Wed, 18 Jun 2025 03:41:32 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> 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. > > ImageIcon(URL) will call ImageIcon(URL, String) where already image null > check was there so I guess it will not throw NPE before fix too.. Indeed, it throws `NullPointerException`: jshell> import javax.swing.ImageIcon; jshell> import java.net.URL; jshell> new ImageIcon((URL) null); | Exception java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null | at ImageIcon.<init> (ImageIcon.java:234) | at (#3:1) https://github.com/openjdk/jdk/blob/984d7f9cdfb0d75ea906ce32df0b6c447f4d5954/src/java.desktop/share/classes/javax/swing/ImageIcon.java#L202-L204 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25767#discussion_r2155041323