[jdk9] (XS) RFR: 8165243: Base64.Encoder.wrap(os).write(byte[], int, int) with incorrect arguments should not produce output
Alan Bateman
Alan.Bateman at oracle.com
Thu Sep 1 17:39:32 UTC 2016
On 01/09/2016 17:40, 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/
TestBase64 is the unit test for this API, should the test be added to
that instead?
-Alan
More information about the core-libs-dev
mailing list