On Thu, 22 Jul 2021 06:35:07 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> checkFromToIndex​ has different semantice with checkIndex:
>> 
>> - checkFromToIndex
>> 
>>      * <ul>
>>      *  <li>{@code fromIndex < 0}</li>
>>      *  <li>{@code fromIndex > toIndex}</li>
>>      *  <li>{@code toIndex > length}</li>
>>      *  <li>{@code length < 0}, which is implied from the former 
>> inequalities</li>
>>      * </ul>
>> 
>> - checkIndex
>> 
>>      * <ul>
>>      *  <li>{@code index < 0}</li>
>>      *  <li>{@code index >= length}</li>
>>      *  <li>{@code length < 0}, which is implied from the former 
>> inequalities</li>
>>      * </ul>
>> 
>> ---
>> 
>> The following tests are passed after applying this patch:
>> 
>> test/jdk/javax/imageio/AppletResourceTest.java
>> test/jdk/javax/imageio/ImageReaderReadAll.java
>> test/jdk/javax/imageio/metadata/IIOMetadataFormat/UserPluginMetadataFormatTest.java
>> 
>> 
>> ClippedImages.java is a manual test, I have no environment to test it, but 
>> since it's a trivial replacement, I think it's okay..
>
> I meant 
> 
> if (imageIndex < minIndex)
>                     throw new IndexOutOfBoundsException();
> 
> can't it be replaced with Objects.checkFromToIndex(minIndex, imageIndex, ..

Hi, sorry for the late response. checkFromToIndex has many constraints, this 
code may not satisfy those constraints, so I don't think we should do that in 
this PR.(Maybe we can file a new PR to do replacement carefully)

-------------

PR: https://git.openjdk.java.net/jdk/pull/4718

Reply via email to