Issue Details (XML | Word | Printable)

Key: CODEC-81
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Julius Davies
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Codec

Base64's new constructor parameters ignored

Created: 26/Jul/09 10:25 PM   Updated: 07/Aug/09 08:11 AM
Return to search
Component/s: None
Affects Version/s: Nightly Builds
Fix Version/s: 1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works codec81-fix.patch 2009-07-26 10:32 PM Julius Davies 10 kB
Text File Licensed for inclusion in ASF works codec81-junit-java14.patch 2009-07-27 06:42 PM Julius Davies 4 kB

Resolution Date: 28/Jul/09 06:06 AM


 Description  « Hide
Base64's new constructor parameters are ignored (e.g. chunkSize and chunkSeparator) when using the Encoder interface.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Julius Davies added a comment - 26/Jul/09 10:32 PM
Two patches attached:

1. codec81-junit.patch highlights the bug.
2. codec81-fix.patch fixes the bug.

There's a tiny bit of code cleanup in there anticipating my next attempt at a CODEC-59 patch - in particular this, since hopefully "instanceof String" will become a valid Object type to decode.

-         if (!(pObject instanceof byte[])) {
+        if (pObject instanceof byte[]) {
+            return decode((byte[]) pObject);
+        } else {
             throw new DecoderException("Parameter supplied to Base64 decode is not a byte[]");
          }

Julius Davies added a comment - 26/Jul/09 10:34 PM
FYI: the "codec81-fix.patch" fix moves all the logic in the two main "public static" methods into member methods instead.

Gary Gregory added a comment - 27/Jul/09 06:08 AM
The patch line:

desiredResult = desiredResult.replace("=", ""); // url-safe has no == padding.

uses a Java 1.5 String API, we are not on 1.5 yet, but we just moved to 1.4.

Can you please re-patch?

Thank you.


Julius Davies added a comment - 27/Jul/09 06:42 PM
Whoops! Previous was not Java1.4 compatible. Sorry!

Gary Gregory added a comment - 28/Jul/09 06:06 AM
Patch applied and then some.