Incorporated code review from r949

This commit is contained in:
Inderjeet Singh 2011-12-16 19:10:54 +00:00
parent a3ca4e1312
commit b5ae3c945a

View File

@ -300,7 +300,11 @@ public final class TypeAdapters {
in.nextNull(); in.nextNull();
return null; 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 @Override
public void write(JsonWriter out, Character value) throws IOException { public void write(JsonWriter out, Character value) throws IOException {