-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b156
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8174585 | 10 | Jayathirth D V | P3 | Resolved | Fixed | b01 |
looking at createArrayForType and TIFFField(TIFFTag tag, int type, int count, Object data):
the 1st checks if count > 0 (for all types) (b110)
the 2nd checks if count > 1 for the rationals.
It seems that the checks should be coherent.
By the way, looking at
http://hg.openjdk.java.net/jdk9/client/jdk/rev/bf20dd25a7ac
- why shouldn't we have check 'count > 0' for the rationals here, as earlier?
It seems to be more natulal to have the same (zero) minimal array size for all the types.
The following check in the constructor
case TIFFTag.TIFF_RATIONAL:
isDataArrayCorrect = data instanceof long[][]
&& ((long[][])data).length == count
&& ((long[][])data)[0].length == 2;
break;
could be replaced with
boolean isDataArrayCorrect = data instanceof long[][]
&& ((long[][])data).length == count
&& (count > 0 ? ((long[][])data)[0].length == 2 : true);
break;
(or does the zero count have some other drawbacks here?)
The user now can have zero length count for all the types excepting the rationals.
the 1st checks if count > 0 (for all types) (b110)
the 2nd checks if count > 1 for the rationals.
It seems that the checks should be coherent.
By the way, looking at
http://hg.openjdk.java.net/jdk9/client/jdk/rev/bf20dd25a7ac
- why shouldn't we have check 'count > 0' for the rationals here, as earlier?
It seems to be more natulal to have the same (zero) minimal array size for all the types.
The following check in the constructor
case TIFFTag.TIFF_RATIONAL:
isDataArrayCorrect = data instanceof long[][]
&& ((long[][])data).length == count
&& ((long[][])data)[0].length == 2;
break;
could be replaced with
boolean isDataArrayCorrect = data instanceof long[][]
&& ((long[][])data).length == count
&& (count > 0 ? ((long[][])data)[0].length == 2 : true);
break;
(or does the zero count have some other drawbacks here?)
The user now can have zero length count for all the types excepting the rationals.
- backported by
-
JDK-8174585 Is it allowed to have zero value for count in TIFFField.createArrayForType() for the rationals
- Resolved