You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Marc Ende (JIRA)" <ji...@apache.org> on 2011/01/23 23:12:45 UTC
[jira] Issue Comment Edited: (CODEC-99) Base64.encodeBase64String()
shouldn't chunk
[ https://issues.apache.org/jira/browse/CODEC-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985433#action_12985433 ]
Marc Ende edited comment on CODEC-99 at 1/23/11 5:11 PM:
----------------------------------------------------------
Yes it's declared static but it CAN also be used as a normal non-static function. In that case it's not behaving correctly.
By the way it's using class-level fields when following the calls (buffer).
Why not using the static - constructor. There you'll can set the standard settings which leads to the results of the static-calls
When used as a normal function it can be modified using the standard constructors.
was (Author: me):
Yes it's declared static but it CAN also be used as a normal non-static function. In that case it's not behaving correctly.
By the way it's using class-level fields when following the calls (buffer).
Why not using the static - constructor. There you'll can set the standard settings which leads to the results of the static-calls
When used as a normal function it can be modified using the constructor.
> 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
> Fix For: 1.5
>
> 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.