File tree 1 file changed +13
-5
lines changed
json-smart/src/main/java/net/minidev/json/parser
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -139,11 +139,19 @@ public void checkLeadinZero() throws ParseException {
139
139
protected Number extractFloat () throws ParseException {
140
140
if (!acceptLeadinZero )
141
141
checkLeadinZero ();
142
- if (!useHiPrecisionFloat )
143
- return Float .parseFloat (xs );
144
- if (xs .length () > 18 ) // follow JSonIJ parsing method
145
- return new BigDecimal (xs );
146
- return Double .parseDouble (xs );
142
+
143
+ try {
144
+ if (!useHiPrecisionFloat )
145
+ return Float .parseFloat (xs );
146
+
147
+ if (xs .length () > 18 ) // follow JSonIJ parsing method
148
+ return new BigDecimal (xs );
149
+
150
+ return Double .parseDouble (xs );
151
+
152
+ } catch (NumberFormatException e ){
153
+ throw new ParseException (pos , ERROR_UNEXPECTED_TOKEN , xs );
154
+ }
147
155
}
148
156
149
157
/**
You can’t perform that action at this time.
0 commit comments