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

Jayathirth D V jayathirth.d.v at oracle.com
Wed Jan 11 17:49:58 UTC 2017


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/ 

 

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/20170111/f8ecad4a/attachment.html>


More information about the 2d-dev mailing list