RFR 8191516: OutputStream.write(byte[], int, int) could have fewer parameter bounds checks
Paul Sandoz
paul.sandoz at oracle.com
Tue Nov 21 17:16:59 UTC 2017
> On 21 Nov 2017, at 08:47, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>
>
> On Nov 20, 2017, at 6:32 PM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>
>> 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.
>
> Both good points. Updated accordingly: http://cr.openjdk.java.net/~bpb/8191516/webrev.01/ <http://cr.openjdk.java.net/~bpb/8191516/webrev.01/>.
>
Looks good. How about updating the read method as well to use the bounds check method? (the len == 0 check makes sense there)?
Paul.
More information about the core-libs-dev
mailing list