-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix text decoration parsing (#473) #475
Conversation
Please add some test coverage for this. |
} else if (peek == JsonToken.STRING || peek == JsonToken.NUMBER) { | ||
return Boolean.parseBoolean(in.nextString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work with e.g. 1
as I see the intention here. Boolean#parseBoolean
:
public static boolean parseBoolean(String s) {
return "true".equalsIgnoreCase(s);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to JsonPrimitive#getAsBoolean()
:
@Override
public boolean getAsBoolean() {
if (isBoolean()) {
return ((Boolean) value).booleanValue();
}
// Check to see if the value as a String is "true" in any case.
return Boolean.parseBoolean(getAsString());
}
The method, is used by the client in Style.Serializer
.
Fix #473
Relates to: https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/JsonPrimitive.java#L100