Commons Codec
  1. Commons Codec
  2. CODEC-97

Base64 default constructor behaviour changed to enable chunking in 1.4

    Details

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

      Description

      The following test passes in commons-codec 1.3 but fails in 1.4:

      public void testObjectEncode() throws Exception {
          Base64 b64 = new Base64();
          assertEquals("SGVsbG8gV29ybGQ=", new String(b64.encode("Hello World".getBytes())));
      }
      

      Commons-codec 1.3 returns "SGVsbG8gV29ybGQ=".

      Commons-codec 1.4 returns "SGVsbG8gV29ybGQ=\r\n".

      I'd understand if you want to close this as "Won't Fix", since the behaviour wasn't documented before (the constructor wasn't even present!) and now it is.

      However, there is still no test for this behaviour on trunk as far as I can tell, so it would be good to add one so it doesn't change again in the future. I'll attach a patch for Base64Test which you can apply on trunk which will do so.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          28d 19h 1 Sebb 27/Mar/10 00:15
          Resolved Resolved Closed Closed
          2d 36m 1 Henri Yandell 29/Mar/10 01:51
          Gary Gregory made changes -
          Fix Version/s 1.5 [ 12315210 ]
          Mark Thomas made changes -
          Workflow jira [ 12500233 ] Default workflow, editable Closed status [ 12601663 ]
          Hide
          Matt Ryall added a comment -

          You may want to update the other tests in the same file, Sebb, which also call getBytes() without an encoding. I drew my inspiration from them.

          See, for example, testObjectEncodeWithValidParameter() which is just above the new test.

          Show
          Matt Ryall added a comment - You may want to update the other tests in the same file, Sebb, which also call getBytes() without an encoding. I drew my inspiration from them. See, for example, testObjectEncodeWithValidParameter() which is just above the new test.
          Henri Yandell made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Sebb made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Sebb added a comment -

          Applied patch with minor change (used UTF-8 encoding for getBytes() to avoid any possible problems on different charsets)

          Show
          Sebb added a comment - Applied patch with minor change (used UTF-8 encoding for getBytes() to avoid any possible problems on different charsets)
          Hide
          Julius Davies added a comment -

          I think this duplicates CODEC-89, which needs more unit tests! Thanks for the test you provided!

          Show
          Julius Davies added a comment - I think this duplicates CODEC-89 , which needs more unit tests! Thanks for the test you provided!
          Julius Davies made changes -
          Link This issue duplicates CODEC-89 [ CODEC-89 ]
          Matt Ryall made changes -
          Link This issue is related to CODEC-96 [ CODEC-96 ]
          Matt Ryall made changes -
          Field Original Value New Value
          Attachment Base64Test-mryall-1.patch [ 12437123 ]
          Matt Ryall created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Matt Ryall
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development