[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-2d-dev
Subject: Re: RFR: 6187113: DefaultListSelectionModel.removeIndexInterval(0, Integer.MAX_VALUE) fails
From: Alexey Ivanov <aivanov () openjdk ! org>
Date: 2022-09-28 9:53:29
Message-ID: KT0UHwEiZuPO2uS1XWDJrlk1wFRdEsgVs1b_IBR3kSM=.2c862a0b-3222-485e-b713-bdd12a7f4097 () github ! com
[Download RAW message or body]
On Wed, 28 Sep 2022 09:41:02 GMT, Prasanta Sadhukhan <psadhukhan@openjdk.org> wrote:
> To remove an index, I guess we need to first do setSelection where we will already \
> throw IOOBE so I guess that's why this method does not mention or handle it \
> explicitly
It's not required by the implementation.
selectionModel.setSelectionInterval(0, 1);
selectionModel.removeIndexInterval(Integer.MIN_VALUE, -1);
works … that is the call to `removeIndexInterval` throws the \
`IndexOutOfBoundsException` because it tries to copy the bits in the removed \
interval. If `rmMinIndex` is negative, the implementation may throw IOOBE before \
doing other work as an optimisation or rely on it being thrown from the code below as \
it does now.
Other methods specify the behaviour for negative parameters, this method would \
benefit from it too.
-------------
PR: https://git.openjdk.org/jdk/pull/10409
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic