Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.6, 1.6-beta-1
-
None
-
OS X, Java 1.5.0_13-119, Groovy from svn HEAD
-
Patch
Description
There are a couple of issues with the current implementation of Base64 encoding method on byte[] and Byte[] in the GDK.
1) The current method is only for chunked (MIME-style) Base64 encoding. My patch adds an option to provide non-chunked Base64 encoding. It unit tests this new method, provides Javadoc comments for it, etc.
2) The chunked implementation incorrectly chunked data into 75 characters per line. The spec (RFC2045) says it should be 76 characters per line. My patch fixes this and adds a unit test for this.
3) The chunk separator is CRLF per the spec. My patch changes the separator to CRLF and adds a unit test for this as well
4) Fixed minor spelling issues in Javadoc
In addition to my unit tests here, I ran some tests on my local machine to make sure the output from Groovy's Base64 encoding matches the results from the Apache Commons Codec Base64 implementation. The results are now identical with the patch.
There is one difficulty in applying this patch. The Groovy file groovy-core/src/test/groovy/Base64Test.groovy is set as binary in the Subversion repository, so I can't diff it. I have attached that file as well. It needs to be converted to text/plain.
This issue came about from GRAILS-3039.