mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8299600: Use Objects.check*() where appropriate in java.io
Reviewed-by: alanb, bpb
This commit is contained in:
parent
4a95c74b76
commit
d086e82b3c
6 changed files with 28 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,6 +26,8 @@
|
|||
package java.io;
|
||||
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Piped character-output streams.
|
||||
*
|
||||
|
@ -150,9 +152,8 @@ public class PipedWriter extends Writer {
|
|||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
if (sink == null) {
|
||||
throw new IOException("Pipe not connected");
|
||||
} else if ((off | len | (off + len) | (cbuf.length - (off + len))) < 0) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
Objects.checkFromIndexSize(off, len, cbuf.length);
|
||||
sink.receive(cbuf, off, len);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue