-
Bug
-
Resolution: Fixed
-
P3
-
8, 16, 17
-
b10
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8317782 | 17.0.10 | Aleksey Shipilev | P3 | Resolved | Fixed | b01 |
The following test throws IllegalArgumentException in ImageIO.read(). According to spec only the following exceptions are expected:
- IllegalArgumentException - if input is null.
- IOException - if an error occurs during reading or when not able to create required ImageInputStream.
There is a discrepancy between the Java specification and the implementation which needs to be resolved. According to the specification the expected outcome for this scenario would be an IOException.
../../../jdk/jdk-17.jdk/Contents/Home/bin/java Test
Exception in thread "main" java.lang.IllegalArgumentException: Invalid scanline stride
at java.desktop/java.awt.image.ComponentSampleModel.getBufferSize(ComponentSampleModel.java:265)
at java.desktop/java.awt.image.ComponentSampleModel.verify(ComponentSampleModel.java:243)
at java.desktop/java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:158)
at java.desktop/java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
at java.desktop/java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
at java.desktop/javax.imageio.ImageTypeSpecifier.getSampleModel(ImageTypeSpecifier.java:1039)
at java.desktop/javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1072)
at java.desktop/javax.imageio.ImageReader.getDestination(ImageReader.java:2877)
at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1159)
at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1127)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1470)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
at Test.reproduceIssue(Test.java:46)
at Test.<init>(Test.java:28)
at Test.main(Test.java:78)
- IllegalArgumentException - if input is null.
- IOException - if an error occurs during reading or when not able to create required ImageInputStream.
There is a discrepancy between the Java specification and the implementation which needs to be resolved. According to the specification the expected outcome for this scenario would be an IOException.
../../../jdk/jdk-17.jdk/Contents/Home/bin/java Test
Exception in thread "main" java.lang.IllegalArgumentException: Invalid scanline stride
at java.desktop/java.awt.image.ComponentSampleModel.getBufferSize(ComponentSampleModel.java:265)
at java.desktop/java.awt.image.ComponentSampleModel.verify(ComponentSampleModel.java:243)
at java.desktop/java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:158)
at java.desktop/java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
at java.desktop/java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
at java.desktop/javax.imageio.ImageTypeSpecifier.getSampleModel(ImageTypeSpecifier.java:1039)
at java.desktop/javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1072)
at java.desktop/javax.imageio.ImageReader.getDestination(ImageReader.java:2877)
at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1159)
at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1127)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1470)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
at Test.reproduceIssue(Test.java:46)
at Test.<init>(Test.java:28)
at Test.main(Test.java:78)
- backported by
-
JDK-8317782 ImageIO.read() throws incorrect exception type
- Resolved
- relates to
-
JDK-8078589 ComponentSampleModel throws IllegalArgumentException on valid images
- Open
- links to
-
Commit openjdk/jdk17u-dev/66baa030
-
Commit openjdk/jdk/6ad6b1c4
-
Review openjdk/jdk17u-dev/1582
-
Review openjdk/jdk/9113
(1 links to)