RFR: 6187113: DefaultListSelectionModel.removeIndexInterval(0, Integer.MAX_VALUE) fails [v6]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Oct 18 05:01:06 UTC 2022


On Tue, 18 Oct 2022 04:56:07 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> DefaultListSelectionModel.removeIndexInterva accepts `int` value which allows it to take in Integer.MAX_VALUE theoratically but it does calculation with that value which can results in IOOBE.
>> Fix is to make sure the calculation stays within bounds.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   insertIndexInterval fix. Add more subtests

Thanks for your suggestive code..
I guess you are now ok with handling Integer.MAX_VALUE in the code rather than only in javadoc.

BTW, your code change resulted in JCK failure so I have used a mix of what I had in previous iterations and your code and this satisfied JCK as well as the unit tests.
Regarding `insertIndexInterval` I guess it's better to address in this PR as it has same issue in same file, so I have added a fix for it also in this PR.

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

PR: https://git.openjdk.org/jdk/pull/10409



More information about the client-libs-dev mailing list