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

Harshitha Onkar honkar at openjdk.org
Tue Sep 27 18:20:19 UTC 2022


On Fri, 23 Sep 2022 13:19:01 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.

Changes requested by honkar (Author).

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.

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

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



More information about the client-libs-dev mailing list