On Thu, 8 Sep 2022 08:45:02 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> I have just added testing `transferTo` with non-empty buffer and mark set as 
>> part of the already existing *randomized* test steps. I think that should be 
>> sufficient to detect problems if they really would exist, so there should 
>> not be a real need to run *explicit and separate* test cases for the 
>> combinations of "buffered with mark" / "buffered without mark" / "unbuffered 
>> with mark" / "unbuffered without mark" as that would not provide any 
>> improved coverage or detection rate IMHO.
>
> My intention of suggesting a test where it uses something like a 
> FileInputStream was to trigger the code path that would invoke the 
> `FileChannel#transferTo` when such an `InputStream` was wrapped in a 
> `BufferedInputStream`. The `FileChannel#transferTo` in its javadoc states 
> that it can throw exceptions that aren't `IOException` (for example 
> `NonReadableChannelException` which is a `IllegalStateException`). So it was 
> just an attempt to see if such a testing uncovers something that might make 
> us consider catching those exceptions in this new implementation of 
> `BufferedInputStream#transferTo` and rethrow it as an `IOException`.

The original implementation of `InputStream::transferTo()` doesn't do that 
either, so if you think `transferTo()` must do that, that has to go into the 
*original* implementation, not only into the one of BIS in particular. To keep 
things simple, I'd propose that we do not mix ideas and you file a new issue / 
PR for that.

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

PR: https://git.openjdk.org/jdk/pull/6935

Reply via email to