[ 
https://issues.apache.org/jira/browse/GROOVY-8478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun reassigned GROOVY-8478:
----------------------------------

    Fix Version/s: 7.0.0-alpha-1
         Assignee: Daniel Sun

> JsonSlurper in 2.4 loses precision of big integers truncating them to longs 
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-8478
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8478
>             Project: Groovy
>          Issue Type: Bug
>          Components: JSON
>    Affects Versions: 2.4.13
>            Reporter: Alexander Astakhov
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1
>
>
> 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.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to