commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Wiedmann (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CODEC-99) Base64.encodeBase64String() shouldn't chunk
Date Tue, 26 Oct 2010 09:20:20 GMT

    [ https://issues.apache.org/jira/browse/CODEC-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924904#action_12924904
] 

Jochen Wiedmann commented on CODEC-99:
--------------------------------------

You possibly wouldn't, because you are encoding a small string, like a password. Others would,
because they are encoding a very large string. Whatever the default, if you need to be sure,
don't use the convenience methods. Period!

The only reason for changing the default would be upwards compatibility. If we change it for
other reasons, we loose upwards compatibility.


> Base64.encodeBase64String() shouldn't chunk
> -------------------------------------------
>
>                 Key: CODEC-99
>                 URL: https://issues.apache.org/jira/browse/CODEC-99
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Julius Davies
>         Attachments: codec-99-test-fixes.patch, codec-99-tests.patch, codec-99.patch
>
>
> Base64.encodeBase64String() shouldn't chunk.
> Change this:
> {code}
> public static String encodeBase64String(byte[] binaryData) {
>     return StringUtils.newStringUtf8(encodeBase64(binaryData, true));
> }
> {code}
> To this:
> {code}
> public static String encodeBase64String(byte[] binaryData) {
>     return StringUtils.newStringUtf8(encodeBase64(binaryData, false));
> }
> {code}
> This will fix the following tests ggregory added a few minutes ago:
>         //assertEquals("Zg==", Base64.encodeBase64String(StringUtils.getBytesUtf8("f")));
>         //assertEquals("Zm8=", Base64.encodeBase64String(StringUtils.getBytesUtf8("fo")));
>         //assertEquals("Zm9v", Base64.encodeBase64String(StringUtils.getBytesUtf8("foo")));
>         //assertEquals("Zm9vYg==", Base64.encodeBase64String(StringUtils.getBytesUtf8("foob")));
>         //assertEquals("Zm9vYmE=", Base64.encodeBase64String(StringUtils.getBytesUtf8("fooba")));
>         //assertEquals("Zm9vYmFy", Base64.encodeBase64String(StringUtils.getBytesUtf8("foobar")));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message