RFR: 8264777: Overload optimized FileInputStream::readAllBytes [v2]

Rémi Forax github.com+828220+forax at openjdk.java.net
Wed May 5 11:02:54 UTC 2021


On Wed, 5 May 2021 06:50:17 GMT, Vladimir Sitnikov <vsitnikov at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8264777: Handle cases where length() returns zero
>
> src/java.base/share/classes/java/io/FileInputStream.java line 284:
> 
>> 282:             long size = length - position;
>> 283:             if (size > (long)Integer.MAX_VALUE)
>> 284:                 throw new OutOfMemoryError("Required array size too large");
> 
> What do you think of adding "length, position, and size" to the exception message?

We usually don't do that for OutOfMemoryError because concatenation implies allocation

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

PR: https://git.openjdk.java.net/jdk/pull/3845


More information about the core-libs-dev mailing list