You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original issue 1255 created by codenameone on 2015-01-04T19:55:30.000Z:
You can reproduce issue using simulator by just parsing some JSON with integer values.
There is special flag useLongsDefault in JSONParser class that can be set via static methods. As I see from the code if this flag is set then all numbers without a dot should be parsed into Long variable. Instead they are parsed into double. After some investigations I figured out that this was caused by the bug in the code (at least I think so).
There are such snippet in few places in method parse(..):
The problem is that method callback.numericToken(..) always treat token as a double value. So I think that for case when long is expected another callback method should be used -> callback.longToken(..).
The text was updated successfully, but these errors were encountered:
Original issue 1255 created by codenameone on 2015-01-04T19:55:30.000Z:
You can reproduce issue using simulator by just parsing some JSON with integer values.
There is special flag useLongsDefault in JSONParser class that can be set via static methods. As I see from the code if this flag is set then all numbers without a dot should be parsed into Long variable. Instead they are parsed into double. After some investigations I figured out that this was caused by the bug in the code (at least I think so).
There are such snippet in few places in method parse(..):
if(useLongsDefault) {
if(ct.indexOf('.') > -1) {
callback.numericToken(Double.parseDouble(ct));
} else {
callback.numericToken(Long.parseLong(ct));
}
} else {
callback.numericToken(Double.parseDouble(ct));
}
The problem is that method callback.numericToken(..) always treat token as a double value. So I think that for case when long is expected another callback method should be used -> callback.longToken(..).
The text was updated successfully, but these errors were encountered: