[Base64] Codereview request for 8006315 8006530 AND 8006295

Chris Hegarty chris.hegarty at oracle.com
Mon Feb 4 16:05:21 UTC 2013

On 04/02/2013 14:20, Alan Bateman wrote:
> On 01/02/2013 16:55, Xueming Shen wrote:
>> Hi,
>> For 8006295 it appears the more reasonable approach is to continue
>> throw IOE
>> but document this behavior clearly at the wrap(is) API. So the change
>> is joined
>> with these two.
>> 8006295: Base64.Decoder.wrap(java.io.InputStream) returns InputStream
>> which throws unspecified IOException on attempt to decode invalid
>> Base64 byte stream
>> http://cr.openjdk.java.net/~sherman/8006295_8006315_8006530/webrev/
>> Thanks!
>> -Sherman
> In Decoder's javadoc then I would suggest "as if followed by padding
> characters(s)" rather than "as if there are padding charcacter(s)
> followed".
> In wrap's javadoc it currently reads:
> "If the input byte stream is not in valid Base64 encoding scheme then
> IOException will be thrown when reading any invalid Base64 byte(s) from
> the returned input stream."
> I guess this okay but an alternative would be:
> "The {@code InputStream} methods that reads from the stream throw {@code
> IOException} if bytes are read that cannot be decoded".


"The {@code read} methods of the returned {@code InputStream} will throw 
{@code IOException} if it encounters bytes that cannot be decoded".

I agree with the approach of specify this behavior in the method 
description of wrap.


> Otherwise this looks okay to me and good to have additional test coverage.
> -Alan.

More information about the core-libs-dev mailing list