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

JPG Reader fails to read the image if thumbnails are present in the input source

XMLWordPrintable

        I am creating a buffered image through ImageIO by reading a jpeg image. I am creating an array list and adding this image to it. I am writing this image as well as the thumbnail list (same image is written as image as well as thumbnail) to a file. Writing process is successful. But when I read the image from this file through ImageIO.read(), I am getting an IIOException: Bogus marker length. This happens only when I use the same image as primary image as well as thumbnail image.

        This is noticed right from JDK1.4 on all platforms.

        I have attached the test and the image. Execute the test. If you get the following exception on the console, the bug is reproduced.

        javax.imageio.IIOException: Bogus marker length
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:554)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:309)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:431)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:547)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:880)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
        at javax.imageio.ImageIO.read(ImageIO.java:1384)
        at javax.imageio.ImageIO.read(ImageIO.java:1270)
        at JPGReaderReadAllTest.<init>(JPGReaderReadAllTest.java:34)
        at JPGReaderReadAllTest.main(JPGReaderReadAllTest.java:50)

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: