diff --git a/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java b/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java index 9da0812d..f0bf3295 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java +++ b/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java @@ -300,7 +300,11 @@ public final class TypeAdapters { in.nextNull(); return null; } - return in.nextString().charAt(0); + String str = in.nextString(); + if (str.length() != 1) { + throw new JsonSyntaxException("Expecting character, got: " + str); + } + return str.charAt(0); } @Override public void write(JsonWriter out, Character value) throws IOException {