[ 
https://issues.apache.org/jira/browse/CODEC-99?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julius Davies updated CODEC-99:
-------------------------------

    Attachment: codec-99-tests.patch


Changes to unit-tests also attached.  Notice that two old tests assume the old, 
erroneous behavior, and so those need to be adjusted, too:

{code}
-        assertEquals("byteToString static Hello World", 
"SGVsbG8gV29ybGQ=\r\n", Base64.encodeBase64String(b1));
+        assertEquals("byteToString static Hello World", "SGVsbG8gV29ybGQ=", 
Base64.encodeBase64String(b1));


-        assertEquals("byteToString static UUID", 
"K/fMJwH+Q5e0nr7tWsxwkA==\r\n", Base64.encodeBase64String(b4));
+        assertEquals("byteToString static UUID", "K/fMJwH+Q5e0nr7tWsxwkA==", 
Base64.encodeBase64String(b4));
{code}

> 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-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.

Reply via email to