[jdk9] (XS) RFR: 8165243: Base64.Encoder.wrap(os).write(byte[], int, int) with incorrect arguments should not produce output

Roger Riggs Roger.Riggs at Oracle.com
Thu Sep 1 17:23:07 UTC 2016

Looks fine Ivan.

Thanks, Roger

On 9/1/2016 12:40 PM, Ivan Gerasimov wrote:
> Hello!
> An encoding output stream 'es' can be obtained as encoder.wrap(os).
> Normally, es.write(buf, off, len) throws IndexOutOfBoundException, if 
> the referenced portion lies outside of the buffer.
> In this case, nothing is written to the underlying output stream 'os'.
> However, if (off + len) overflows, then the call to write() will 
> produce some output, and only when it reaches the boundary of the buf 
> will it throw the exception.
> This behavior looks inconsistent.
> Would you please help review the simple fix?
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8165243
> WEBREV: http://cr.openjdk.java.net/~igerasim/8165243/00/webrev/
> With kind regards,
> Ivan

More information about the core-libs-dev mailing list