Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.4.13
-
None
-
None
Description
Consider the following json string:
{"x":11819408672106971000}
When parsed by a JsonSlurper x value is trimmed to a -6627335401602580616 as a result of the Long overflow.
The reason for this is the following code in the CharScanner.java starting from line 660:
final int length = index - from;
if (!foundDot && simple) {
if (isInteger(buffer, from, length)) {
value = parseIntFromTo(buffer, from, index);
} else {
value = parseLongFromTo(buffer, from, index);
}
} else {
value = parseBigDecimal(buffer, from, length);
}
Basically all the numbers besides ones in the scientific notation or containing dots are treated as long at best.