-
Bug
-
Resolution: Fixed
-
P3
-
6u75, 7u25, 9
-
b22
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8048382 | 8u25 | Anton Nashatyrev | P3 | Resolved | Fixed | b05 |
JDK-8044412 | 8u20 | Anton Nashatyrev | P3 | Resolved | Fixed | b20 |
JDK-8053638 | emb-8u26 | Anton Nashatyrev | P3 | Resolved | Fixed | b17 |
JDK-8044413 | 7u80 | Anton Nashatyrev | P3 | Resolved | Fixed | b01 |
JDK-8061031 | 7u79 | Anton Nashatyrev | P3 | Resolved | Fixed | b01 |
JDK-8057355 | 7u76 | Anton Nashatyrev | P3 | Resolved | Fixed | b01 |
JDK-8049459 | 7u72 | Anton Nashatyrev | P3 | Resolved | Fixed | b03 |
JDK-8049265 | 7u71 | Anton Nashatyrev | P3 | Closed | Fixed | b03 |
JDK-8049865 | 6-pool | Anton Nashatyrev | P3 | Closed | Won't Fix |
Instead, a NullPointerException is thrown, and execution hangs.
For example, with 7u25:
Uncaught error fetching image:
java.lang.NullPointerException
at java.io.FileInputStream.<init>(FileInputStream.java:134)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at sun.awt.image.FileImageSource.getDecoder(FileImageSource.java:53)
at
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:263)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)
Taking a thread dump then reveals that the main thread has gone into an
Object.wait(), and it will remain there forever because the "Image Fetcher 0"
thread failed to fetch an image:
"Image Fetcher 0" daemon prio=8 tid=0x046e4000 nid=0x7964 in Object.wait()
[0x0520f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0f0b06e0> (a java.util.Vector)
at sun.awt.image.ImageFetcher.nextImage(ImageFetcher.java:147)
- locked <0x0f0b06e0> (a java.util.Vector)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:200)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)
"main" prio=6 tid=0x0223bc00 nid=0x8784 in Object.wait() [0x0238f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0f0afe38> (a java.awt.MediaTracker)
at java.awt.MediaTracker.waitForID(MediaTracker.java:667)
- locked <0x0f0afe38> (a java.awt.MediaTracker)
at javax.swing.ImageIcon.loadImage(ImageIcon.java:302)
- locked <0x0f0afe38> (a java.awt.MediaTracker)
at javax.swing.ImageIcon.<init>(ImageIcon.java:153)
at javax.swing.ImageIcon.<init>(ImageIcon.java:174)
at TestImageIcon.main(TestImageIcon.java:3)
TestCase:
public class TestImageIcon {
public static void main (String args[]) throws Exception{
javax.swing.ImageIcon ic = new javax.swing.ImageIcon((String)null);
}
}
- backported by
-
JDK-8044412 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8044413 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8048382 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8049459 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8053638 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8057355 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8061031 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Resolved
-
JDK-8049265 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Closed
-
JDK-8049865 ImageIcon constructor throws an NPE and hangs when passed a null String parameter
- Closed