Base64Utils falls back to JAXB DatatypeConverter for String-based encoding

Issue: SPR-12938
This commit is contained in:
Juergen Hoeller
2015-06-26 22:06:13 +02:00
parent 5b47504dd4
commit a5349eb2f8
3 changed files with 81 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,10 +52,6 @@ public abstract class GsonBuilderUtils {
* On Java 8, the standard {@link java.util.Base64} facility is used instead.
*/
public static GsonBuilder gsonBuilderWithBase64EncodedByteArrays() {
// Assert that Base64 support is available, as long we're not on Java 8+
Base64Utils.encode(null);
// Now, construct a pre-configured GsonBuilder...
GsonBuilder builder = new GsonBuilder();
builder.registerTypeHierarchyAdapter(byte[].class, new Base64TypeAdapter());
return builder;