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

Сергей Цыпанов github.com+10835776+stsypanov at openjdk.java.net
Thu May 6 06:08:52 UTC 2021


On Wed, 5 May 2021 13:20:13 GMT, Vladimir Sitnikov <vsitnikov at openjdk.org> wrote:

>> We usually don't do that for OutOfMemoryError because concatenation implies allocation
>
> Well, here `OutOfMemory` is more like "I can't read all the data since the array won't fit".
> It would definitely help to have actual file size there, especially in case filesystem returns weird values (e.g. negative file length).
> 
> This branch will almost never be taken, and even if taken, it won't be "low memory" condition. So the allocation does not hurt, however, it would simplify the analysis should the case trigger.

What about adding the filename into exception message?

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

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


More information about the core-libs-dev mailing list