- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    7u79, 8u60, 9
- 
        b127
- 
        x86
- 
        generic
                    FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Certain JPEGs with embedded thumbnails in APP1 markers throw an exception when attempting to read in the width of second preview image. Example image is here:
https://github.com/haraldk/TwelveMonkeys/issues/202
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call getWidth on the image reader for the second image:
ImageReader reader;
int pageNum = 1;
int width = reader.getWidth(pageNum + reader.getMinIndex());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The thumbnail width is returned
ACTUAL -
Caused by: javax.imageio.IIOException: Not a JPEG file: starts with 0xff 0xe9
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(JPEGImageReader.java)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:609)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:603)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getWidth(JPEGImageReader.java:716)
REPRODUCIBILITY :
This bug can be reproduced always.
            
A DESCRIPTION OF THE PROBLEM :
Certain JPEGs with embedded thumbnails in APP1 markers throw an exception when attempting to read in the width of second preview image. Example image is here:
https://github.com/haraldk/TwelveMonkeys/issues/202
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call getWidth on the image reader for the second image:
ImageReader reader;
int pageNum = 1;
int width = reader.getWidth(pageNum + reader.getMinIndex());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The thumbnail width is returned
ACTUAL -
Caused by: javax.imageio.IIOException: Not a JPEG file: starts with 0xff 0xe9
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(JPEGImageReader.java)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:609)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:603)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getWidth(JPEGImageReader.java:716)
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
- 
                    JDK-6825458 JPEGImageReader can return an image at index 1 even if it doesn't exist -           
- Closed
 
-         
- relates to
- 
                    JDK-8162950 ImageIO is not calculating length of APP0/JFXX thumbnails properly -           
- Open
 
-         
- 
                    JDK-8160327 Support for thumbnails present in APP1 marker for JPEG -           
- Resolved
 
-         
