Skip to content

Commit

Permalink
Merge pull request #61 from GanbaruTobi/master
Browse files Browse the repository at this point in the history
Possible fix for Exception handling
  • Loading branch information
UrielCh authored Apr 1, 2021
2 parents ba7be16 + c98873a commit 5504116
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,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 5504116

Please sign in to comment.