[OpenJDK 2D-Dev] [9] RFR JDK-8152561: Is it allowed to have zero value for count in TIFFField.createArrayForType() for the rationals

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Tue Jan 17 07:17:42 UTC 2017


Looks good to me.

Only thing is that in the test, if one test fails it will not proceed to 
the next test. I think we should test all combinations and fail at last 
with the informations of all failed combinations.

Regards
Prasanta
On 1/11/2017 11:19 PM, Jayathirth D V wrote:
>
> Hello All,
>
> Please review the following  fix in JDK9:
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-8152561
>
> Webrev : http://cr.openjdk.java.net/~jdv/8152561/webrev.00/ 
> <http://cr.openjdk.java.net/%7Ejdv/8152561/webrev.00/>
>
> Issue : There is difference in how we interpret “count” variable 
> passed to TIFFField.createArrayForType(int dataType, int count) and 
> constructor TIFFField(TIFFTag tag, int type, int count, Object data).
>
> Root cause : There are certain limitation on what the “count” value 
> should be based on dataType of TIFFTag. We check these conditions in 
> TIFFField(TIFFTag tag, int type, int count, Object data) but we don’t 
> verify all the conditions in TIFFField.createArrayForType(int 
> dataType, int count).
>
> Solution : Verify all the required conditions that has to be applied 
> on “count” variable based on datatype of TIFFTag in 
> TIFFField.createArrayForType(int dataType, int count). Also I have 
> made specification changes for TIFFField(TIFFTag tag, int type, int 
> count) which will elaborate on what exceptions will be thrown if we 
> don’t follow same “count” and “dataType” relationship.
>
> Note : Because of tighter conditions in 
> TIFFField.createArrayForType(int dataType, int count) under the 
> proposed fix 2 JCK tests are failing.
>
> 1)_api/javax_imageio/plugins/tiff/TIFFField/index.html#TIFFFieldTest : 
> /CreateArrayForType_ValidScenario/_
>
> This is failing because they are passing count values of 0 for 
> TIFFTag.TIFF_RATIONAL & TIFFTag.TIFF_SRATIONAL which will throw IAE. 
> Also it will throw IAE if we pass count value 0 or 2 for 
> TIFFTag.TIFF_IFD_POINTER.
>
> 2)_api/javax_imageio/plugins/tiff/TIFFField/index.html#ConstructorTests 
> : /Constructor02_TagIsNull_ThrowNPE/_
>
> I think this scenario expects constructor to throw NPE when “tag” is 
> null. But before it checks for “tag” value in TIFFField(TIFFTag tag, 
> int type, int count, Object data) we call 
> TIFFField.createArrayForType(int dataType, int count) to create needed 
> data. So like mentioned in previous JCK test which is failing, we will 
> be throwing IAE in all cases where as test expects us to throw NPE.
>
> Thanks,
>
> Jay
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20170117/2fd11fc7/attachment.html>


More information about the 2d-dev mailing list