Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4874601

Calling Reader.reset() inside the listener methods causes VM Crash

    XMLWordPrintable

Details

    Backports

      Description

        I am using a JPEG ImageReader to read a jpeg image from a file. I have added an IIOReadProgressListener and an IIOReadUpdateListener to this ImageReader. When I tried to call reset() inside one of the listener's methods such as imageProgress(), imageUpdate(), passStarted(), passComplete() etc, the VM crashes. Same behavior is noticed even when dispose() or setInput() is called inside one of the listener's methods. This is reproducible with JPG reader alone on Solaris as well as Win32 platforms right from JDK1.4+.

        Calling reset() / setInput() inside the imageProgress() method throws NullPointerException for GIF and PNG readers. Calling dispose() inside the same method does not have any effect for these ImageReaders.

        I have attached 2 sample codes. ImageReaderTest.java can be executed to reproduce the VM crash and ImageReaderTest2.java can be executed to reproduce the NullPointerException. I tested this on WinXP and Solaris 8.
        Here is the exception:
        java.lang.NullPointerException
        at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1165)
        at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1287)
        at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1362)
        at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1530)
        at javax.imageio.ImageReader.read(ImageReader.java:919)
        at ImageReaderTest2.<init>(ImageReaderTest2.java:31)
        at ImageReaderTest2.main(ImageReaderTest2.java:39)

        I have also attached the log file created at the time of VM crash.

        Attachments

          Issue Links

            Activity

              People

                bae Andrew Brygin
                pmohansunw Praveen Mohan (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: