21 Nov
2017
21 Nov
'17
2:32 a.m.
On 20 Nov 2017, at 16:53, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
https://bugs.openjdk.java.net/browse/JDK-8191516 http://cr.openjdk.java.net/~bpb/8191516/webrev.00/
Change OutputStream.write(byte[],int,int) to use the same three parameter bounds checks used by InputStream.read(byte[],int,int) instead of the five checks currently used. This change is covered by the existing test jdk/java/io/OutputStream/WriteParams.java.
See also Objects.checkFromIndexSize if you wanna use that instead. Also the if len == 0 check is probably redundant, i doubt it makes any difference given the condition needs to be checked before entering the loop. Paul.