jdaugherty commented on code in PR #15828:
URL: https://github.com/apache/grails-core/pull/15828#discussion_r3538024503
##########
grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/Base64CodecExtensionMethods.groovy:
##########
@@ -24,32 +24,35 @@ import org.codehaus.groovy.runtime.NullObject
import org.apache.commons.codec.binary.Base64
+import groovy.transform.CompileStatic
+
/**
* A codec that encodes and decodes Objects using Base64 encoding.
*
* @author Drew Varner
*/
+@CompileStatic
class Base64CodecExtensionMethods {
- static encodeAsBase64(theTarget) {
+ static Object encodeAsBase64(Object theTarget) {
if (theTarget == null || theTarget instanceof NullObject) {
return null
}
if (theTarget instanceof Byte[] || theTarget instanceof byte[]) {
- return new String(Base64.encodeBase64(theTarget))
+ return new
String(Base64.encodeBase64(DigestUtils.toByteArray(theTarget)),
StandardCharsets.UTF_8)
Review Comment:
UTF_8 should be an added method argument that is defaulted to this value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]