RFR: 8374308: ImageBufferCache does not work as intended [v2]

Johan Sjölen jsjolen at openjdk.org
Mon Jan 5 19:21:11 UTC 2026


On Mon, 5 Jan 2026 17:52:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   actually remove the class ...
>
> 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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29043#discussion_r2662538975


More information about the core-libs-dev mailing list