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

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Sep 28 04:29:24 UTC 2022


On Tue, 27 Sep 2022 18:10:39 GMT, Harshitha Onkar <honkar 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.
>
> test/jdk/javax/swing/TestDefListModelExcpn.java line 33:
> 
>> 31: 
>> 32: public class TestDefListModelExcpn {
>> 33:     public static void main(String[] args) throws Exception {
> 
> @prsadhuk A more descriptive exception message using try catch block would be more helpful than a generic throws Exception on the main method.

I am not sure it will, it is throwing IOOBE with the statcktrace by default and we normally relied on that for such exceptions AIOBE, IOOBE, CCE etc, not needed to catch and rethrow

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

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



More information about the client-libs-dev mailing list