Skip to content
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

JsonElement's getAsInt() doesn't throw an Error when converting an too big exponential value #630

Open
GoogleCodeExporter opened this issue Apr 4, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
Example:
String json = "{\"id\":1e10000010}";
JsonParser parser = new JsonParser();
JsonObject jsonObj = (JsonObject) parser.parse(json);
Date before = new Date();
Integer Id = jsonObj.get("id").getAsInt();
Date after = new Date();
Long diff = after.getTime() - before.getTime();
System.out.println("Id: " + Id + "   Milliseconds: " + diff);

Output: Id: 0   Milliseconds: 9714

What is the expected output? What do you see instead?
It should throw an error, but instead returns 0 after a long time.

What version of the product are you using? On what operating system?
Gson 2.3.1
Ubuntu 14.04

Original issue reported on code.google.com by [email protected] on 4 Mar 2015 at 2:41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant