We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a052934 + 3db4106 commit d07cf9fCopy full SHA for d07cf9f
json-smart/src/main/java/net/minidev/json/parser/JSONParserBase.java
@@ -134,11 +134,19 @@ public void checkLeadinZero() throws ParseException {
134
protected Number extractFloat() throws ParseException {
135
if (!acceptLeadinZero)
136
checkLeadinZero();
137
- if (!useHiPrecisionFloat)
138
- return Float.parseFloat(xs);
139
- if (xs.length() > 18) // follow JSonIJ parsing method
140
- return new BigDecimal(xs);
141
- return Double.parseDouble(xs);
+
+ try {
+ if (!useHiPrecisionFloat)
+ return Float.parseFloat(xs);
142
+ if (xs.length() > 18) // follow JSonIJ parsing method
143
+ return new BigDecimal(xs);
144
145
+ return Double.parseDouble(xs);
146
147
+ } catch(NumberFormatException e){
148
+ throw new ParseException(pos, ERROR_UNEXPECTED_TOKEN, xs);
149
+ }
150
}
151
152
/**
0 commit comments