RFR: 8325382: (fc) FileChannel.transferTo throws IOException when position equals size

Brian Burkhalter bpb at openjdk.org
Fri Feb 9 20:00:17 UTC 2024


In `FileChannelImpl.transferTo`, do not clamp the number of bytes to transfer to the number remaining in the source `FileChannel` unless the size of the source is positive. When clamping, do not use the strict inequality `remaining > 0`, but rather allow clamping to zero.

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

Commit messages:
 - 8325382: (fc) FileChannel.transferTo throws IOException when position equals size

Changes: https://git.openjdk.org/jdk/pull/17796/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17796&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325382
  Stats: 46 lines in 2 files changed: 32 ins; 9 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/17796.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17796/head:pull/17796

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


More information about the nio-dev mailing list