RFR: 8233451: (fs) Files.newInputStream() cannot be used with character special files [v2]

Brian Burkhalter bpb at openjdk.org
Thu Oct 17 22:59:57 UTC 2024


On Thu, 17 Oct 2024 11:17:43 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - 8233451: Remove use of handleAvailable() (Windows)
>>  - 8233451: Remove use of handleAvailable() (UNIX)
>
> src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java line 565:
> 
>> 563:                 return isOther = nd.isOther(fd);
>> 564:             } finally {
>> 565:                 Blocker.end(attempted);
> 
> No need for Blocker begin/end here, we only use for direct I/O or file locking.

Fixed in a163d8d.

> test/jdk/java/nio/file/Files/InputStreamTest.java line 139:
> 
>> 137:             InputStream s = Files.newInputStream(stdin);
>> 138:             s.available();
>> 139:         }
> 
> I assume you meant to close the input stream.
> 
> What about the other methods defined by InputStream that have special handling in ChannelInputStream? I assume we should add test coverage for these methods.

I added test coverage for `skip` but not for `readAllBytes` nor `readNBytes`:
- `readAllBytes` throws before but hangs after the change;
- `readNBytes` hangs both before and after the change.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1805546933
PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1805546604


More information about the nio-dev mailing list