* What steps will reproduce the problem?
Try executing either of these lines:
Double x = new Gson().fromJson("1E+5", Double.class);
BigDecimal y = new Gson().fromJson("1E+5", BigDecimal.class);
* What is the expected output? What do you see instead?
The expected result is a Double or BigDecimal containing the value 100000.
The actual behaviour is a NumberFormatException thrown from within the
java.math.BigDecimal constructor. The key line is in the method
JsonParser.JsonNumber():
n = new java.math.BigDecimal(intpart + fracpart + exppart);
At this point, fracpart is null because there is no decimal point in
"1E+5", and so the string addition produces "1nullE+5". Is this a bug
in JsonParser.jj or perhaps even in the parser generator?
* What version of the product are you using? On what operating system?
I'm using Gson release 1.2.3 on Linux.
Original issue reported on code.google.com by p...@zesty.ca on 18 Nov 2008 at 12:39
Original issue reported on code.google.com by
p...@zesty.ca
on 18 Nov 2008 at 12:39