javax.imageio.IIOException: Bogus marker length

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by Praveen Mohan,
  • Reading picture from byte array
    via Stack Overflow by Edison
    ,
  • I/O error reading PNG header
    via by Unknown author,
    • 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)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    serious2monkeys
    serious2monkeys3 times, last one,
    rexgreenza
    rexgreenza10 times, last one,
    Unknown visitor1 times, last one,
    19 more bugmates