Skip to content

Commit

Permalink
Merge pull request #8 from GanbaruTobi/master
Browse files Browse the repository at this point in the history
Uncaught Exception in Parser - Fix
  • Loading branch information
UrielCh authored Apr 4, 2021
2 parents a052934 + 3db4106 commit d07cf9f
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,19 @@ public void checkLeadinZero() throws ParseException {
protected Number extractFloat() throws ParseException {
if (!acceptLeadinZero)
checkLeadinZero();
if (!useHiPrecisionFloat)
return Float.parseFloat(xs);
if (xs.length() > 18) // follow JSonIJ parsing method
return new BigDecimal(xs);
return Double.parseDouble(xs);

try {
if (!useHiPrecisionFloat)
return Float.parseFloat(xs);

if (xs.length() > 18) // follow JSonIJ parsing method
return new BigDecimal(xs);

return Double.parseDouble(xs);

} catch(NumberFormatException e){
throw new ParseException(pos, ERROR_UNEXPECTED_TOKEN, xs);
}
}

/**
Expand Down

0 comments on commit d07cf9f

Please sign in to comment.