Commons Codec
  1. Commons Codec
  2. CODEC-99

Base64.encodeBase64String() shouldn't chunk

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Labels:
      None

      Description

      Base64.encodeBase64String() shouldn't chunk.

      Change this:

      public static String encodeBase64String(byte[] binaryData) {
          return StringUtils.newStringUtf8(encodeBase64(binaryData, true));
      }
      

      To this:

      public static String encodeBase64String(byte[] binaryData) {
          return StringUtils.newStringUtf8(encodeBase64(binaryData, false));
      }
      

      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")));

      1. codec-99.patch
        0.6 kB
        Julius Davies
      2. codec-99-javadoc.patch
        1 kB
        Julius Davies
      3. codec-99-test-fixes.patch
        2 kB
        Julius Davies
      4. codec-99-tests.patch
        3 kB
        Julius Davies

        Activity

        Julius Davies created issue -
        Julius Davies made changes -
        Field Original Value New Value
        Description 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, true));
        }
        {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")));

        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")));

        Julius Davies made changes -
        Attachment codec-99.patch [ 12439947 ]
        Julius Davies made changes -
        Attachment codec-99-tests.patch [ 12439948 ]
        Julius Davies made changes -
        Attachment codec-99-test-fixes.patch [ 12439949 ]
        Julius Davies made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.5 [ 12315210 ]
        Resolution Fixed [ 1 ]
        Julius Davies made changes -
        Attachment codec-99-javadoc.patch [ 12469228 ]
        Mark Thomas made changes -
        Workflow jira [ 12503120 ] Default workflow, editable Closed status [ 12601655 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Julius Davies
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development