javax.imageio.IIOException: Bogus marker length

JDK Bug System | Praveen Mohan | 1 decade ago
  1. 0

    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)

    JDK Bug System | 1 decade ago | Praveen Mohan
    javax.imageio.IIOException: Bogus marker length
  2. 0

    How to display BufferedImage using JPanel

    Oracle Community | 1 decade ago | 843804
    javax.imageio.IIOException: Can't get input stream from URL!
  3. 0

    Image Blender is failing to load the OverlayHook.png

    GitHub | 2 years ago | lordoku
    javax.imageio.IIOException: Can't read input file!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Movie Maker throws Java Exception from files exported with saveFrame()

    GitHub | 3 years ago | ld26464
    javax.imageio.IIOException: Error reading PNG image data

  1. serious2monkeys 3 times, last 2 months ago
  2. rexgreenza 10 times, last 3 months ago
  3. ptrstovka 2 times, last 8 months ago
15 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. javax.imageio.IIOException

    Bogus marker length

    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader()
  2. Java RT
    ImageIO.read
    1. com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
    2. com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:554)
    3. com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:309)
    4. com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:431)
    5. com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:547)
    6. com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:880)
    7. com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
    8. javax.imageio.ImageIO.read(ImageIO.java:1384)
    9. javax.imageio.ImageIO.read(ImageIO.java:1270)
    9 frames
  3. Unknown
    JPGReaderReadAllTest.main
    1. JPGReaderReadAllTest.<init>(JPGReaderReadAllTest.java:34)
    2. JPGReaderReadAllTest.main(JPGReaderReadAllTest.java:50)
    2 frames