[OpenJDK 2D-Dev] [11] RFR: [JDK-4954348]: JPGWriter.getNumThumbnailsSupported does not return -1 when passing null values

Krishna Addepalli krishna.addepalli at oracle.com
Fri Mar 23 09:14:03 UTC 2018


Hi Prahalad,

The changes look fine to me.

Thanks,
Krishna

-----Original Message-----
From: Prahalad Kumar Narayanan 
Sent: Friday, March 23, 2018 1:40 PM
To: 2d-dev <2d-dev at openjdk.java.net>
Subject: [OpenJDK 2D-Dev] [11] RFR: [JDK-4954348]: JPGWriter.getNumThumbnailsSupported does not return -1 when passing null values

Hello Everyone

Good day to you.

Request your time to review a simple fix for the bug
    Bug: JDK-4954348 (https://bugs.openjdk.java.net/browse/JDK-4954348)
    Title: JPGWriter.getNumThumbnailsSupported does not return -1 when passing null values

Root Cause:
    . As per ImageWriter specification, the method- getNumThumbnailsSupported, should return -1 when invoked with insufficient data.
    . However, the method's implementation in JpegImageWriter returns 0 instead of -1 in this use-case. 

Information on the fix:
    . The logic within concerned method of Jpeg image writer requires one of the two inputs- ImageTypeSpecifer (or) IIOMetadata.
    . If both the required inputs are 'Null' the method has insufficient data & thus cannot validate. 
    . A simple check is now added in the method to detect this use-case and return -1 as recommended in the specification.

Kindly review the changes at your convenience
Link: http://cr.openjdk.java.net/~pnarayanan/4954348/webrev.00

Thank you
Have a good day

Prahalad N.


More information about the 2d-dev mailing list