Codereview request for 8006295: Base64.Decoder.wrap(java.io.InputStream) returns InputStream which throws unspecified IOException on attempt to decode invalid Base64 byte stream
Alan.Bateman at oracle.com
Fri Feb 1 09:34:53 UTC 2013
On 31/01/2013 22:15, Xueming Shen wrote:
> Obviously ioe is not an appropriate exception for invalid base64 bytes,
> and it's inconsistent with the rest of decode methods, as the submitter
> The change is to explicitly specify (as other decoding methods do) that
> IAE will be thrown if the input stream contains invalid base64 bytes. The
> impl is also updated according.
> Please help review.
I don't think IAE is right here as the problem is not with the argument
passed to the InputStream read method. The simplest thing is probably to
just make it clear in the wrap's javadoc that the reading from the
InputStream will throw IOException if bytes, that are not in a valid
base64 scheme, are encountered. This would be consistent with say,
reading from a BufferedReader where malformed or unmappable characters
are encountered (assuming it is created with a charset decoder that is
configured to report errors of course).
More information about the core-libs-dev