8275149: (ch) ReadableByteChannel returned by Channels.newChannel(InputStream) throws ReadOnlyBufferException

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2021-10-15 22:58:21 +00:00
parent 831802ddb1
commit 7fc3a8d052
2 changed files with 12 additions and 2 deletions

View file

@ -295,6 +295,9 @@ public final class Channels {
if (!isOpen()) {
throw new ClosedChannelException();
}
if (dst.isReadOnly()) {
throw new IllegalArgumentException();
}
int len = dst.remaining();
int totalRead = 0;