On Sun, 18 Oct 2026 05:46:45 GMT, Alan Bateman <[email protected]> wrote:

> > It sounds like it was the right call to deduplicate JDK-8394737 into then 
> > JDK-8387022, since my issue is one part of the original.
> 
> Would it be possible to zoom out for a moment and explain how you got here? 
> Did you encounter a class that extends FIS and overrides read with a broken 
> implementation or it was this a drive-by observation?

It was a drive-by observation; I have been reading `ChannelInputStream` and 
`FileInputStream` implementations closely in the course of investigations that 
led me to file https://bugs.openjdk.org/browse/JDK-8394231. I have seen the 
`(byte)read()` cast bug in a number of `InputStream` implementations over the 
years, so it stuck out.

> 
> JDK-8387022 is about the problematic readNBytes implementation in FIS and 
> sun.nio.ch.CIS.readNBytes. It's the same code where it doesn't handle read 
> returning 0 correctly.

Right, and my impulse was to delete these blocks, since they can only happen 
for non-conforming subclasses or implementations.

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

PR Comment: https://git.openjdk.org/jdk/pull/33401#issuecomment-6246279662

Reply via email to