RFR: 8255878: FilterInputStream is missing implementations of Java 9 InputStream methods [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Mon Sep 6 09:45:54 UTC 2021

On Sat, 4 Sep 2021 07:02:32 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Can you explain this a bit further? InputStream has one abstract method so that's the minimum that has to be implemented. It has base implementations of readAllBytes and readNBytes that would be very inefficient if the 3-arg read is not overridden but I wouldn't expect a correctness issue.

readAllBytes/readNBytes no longer call any variant of `this.read` - so any subclass that implement the two `read` methods to do something more than what `in.read` does might fail in unexpected ways if `readAllBytes` or `readNBytes` are called. I'm especially concerned with subclasses like e.g. `KeepAliveStream` / `MetteredStream` in `sun.net.www.http`


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

More information about the core-libs-dev mailing list