-
Notifications
You must be signed in to change notification settings - Fork 453
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
JsonParser does not document exception handling #1353
Comments
We should probably add another test to https://github.com/googleapis/google-http-java-client/blob/master/google-http-client-test/src/main/java/com/google/api/client/test/json/AbstractJsonParserTest.java on the handling of invalid JSON. |
That sounds like a good idea. |
Also related to this is that the same parser input may or may not throw depending on the underlying library used. For example given a plain text input like |
GSON is not as configurable as its docs claim. In particular, the API doc for |
At least the simple case below works as expected when JsonReader reader = new JsonReader(new StringReader("not json"));
reader.hasNext(); This throws:
|
I'd like to introduce a |
@BenWhitehead @vam-google Should this be assigned to one of you? |
In the monorepo, I am attempting to migrate the entirety from Jackson and Jackson2 to Gson, in part because this repo has already deleted Jackson support and in part because of pressure from security. I am running into this case (and others documented in googleapis/google-api-java-client#1779). Do you all have a general plan for what you would do here if you were to tackle it? My choices are to instrument the consumers' code (where I can figure out where it's relevant, which is difficult) to handle the additional |
* use GSon instead of Jackson * remove jackson2 * fix callback
JsonParser.parseAndClose and similar methods do not document which exceptions are thrown under what circumstances. The Jackson and GSON subclasses are in fact throwing different exceptions, IO and IllegalArgument to name two, for the same input. This needs to be documented and made consistent.
The text was updated successfully, but these errors were encountered: