Codereview Request for 8007379: Base64.getMimeDecoder().decode() throws IAE for a non-base64 character after padding

Alan Bateman Alan.Bateman at oracle.com
Tue Apr 2 14:39:08 UTC 2013


On 27/03/2013 22:20, Xueming Shen wrote:
> Hi,
>
> Please help review the fix for the following two bugs:
>
> (1) 8007379: Base64.getMimeDecoder().decode() throws IAE for a 
> non-base64 character after padding
> We fixed the similar issue in 8006530, it appears there is "yet 
> another" corner case
> to close here. As described in the bug report, the calculation for 
> output buffer size
> for such case is incorrect when decoding in mime mode. The proposed 
> change
> should fix the problem.
>
> (2) 8008925: Base64.getMimeDecoder().decode() does not ignore padding 
> chars
> The change is to clarify the specification that "the padding 
> character(s) is not
> required for decoding. BUT, if the padding character(s) does appear, 
> they must
> be correctly encoded."
>
> http://cr.openjdk.java.net/~sherman/8007379_8008925/webrev
These corner cases are a pain. The implementation changes look fine to me.

For the javadoc change then I suggest

"But if" --> "If"

"otherwise the IllegalArgumentException will be thrown"  --> "otherwise 
{@code IllegalArgumentException} is thrown during decoding".

-Alan.



More information about the core-libs-dev mailing list