On Mon, 5 Jan 2026 19:14:12 GMT, Johan Sjölen <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line
>> 392:
>>
>>> 390: private static ByteBuffer allocateBuffer(long size) {
>>> 391: if (size < 0 || Integer.MAX_VALUE < size) {
>>> 392: throw new IndexOutOfBoundsException("size");
>>
>> I don't think it can happen but I assume IAE would be more appropriate here
>> as size is not an index.
>
> Only needs to check for the `Integer.MAX_VALUE` in any case, as
> `ByteBuffer::allocateDirect` throws on `size < 0`. It also uses IAE
Fair points. This is just moved code, but IOOBE is clearly not the right choice
here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29043#discussion_r2664444964