wei-spring / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

NewVM: parseJSON returns wrong data #1313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the new VM, the JSONParser class parses some numerical data incorrectly.  
E.g.

public static final String PERIOD_DATA =
        "{\"synobsysNacalculatiePerWeekItems\": [\n" +
        "  {\n" +
        "    \"boekjaar\": 2015,\n" +
        "    \"medewerker\": \"GRM4\",\n" +
        "    \"periode\": 4,\n" +
        "    \"verwerkt\": false,\n" +
        "    \"totaalGeboekteUren\": 40\n" +
        "  }";

Will be parsed as 
{synobsysNacalculatiePerWeekItems=[{boekjaar=2015.000000, medewerker=GRM4, 
periode=4.000000, verwerkt=false, totaalGeboekteUren=0.400000}

Notice that "40" is parsed as 0.4.   Interestingly it parsed "4" correctly as 
4.0.

Parsing works correctly on the simulator and the Old VM.  This issue was 
reported in the forum also
http://www.codenameone.com/discussion-forum.html?place=msg%2Fcodenameone-discuss
ions%2F6wpa-W0GQYs%2FyGN5x_A1R-oJ

Original issue reported on code.google.com by st...@weblite.ca on 26 Jan 2015 at 7:25

GoogleCodeExporter commented 9 years ago
I have distilled it down to a simpler test case:

Double.parseDouble("40");

This produces "0.4" on the new VM.

Original comment by st...@weblite.ca on 26 Jan 2015 at 8:22

GoogleCodeExporter commented 9 years ago
Fixed.
https://code.google.com/p/codenameone/source/detail?r=2041

Original comment by st...@weblite.ca on 26 Jan 2015 at 9:03