@@ -780,6 +780,9 @@ public JsonToken nextToken() throws IOException
780
780
781
781
// Should we have separate handling for plus? Although it is not allowed per se,
782
782
// it may be erroneously used, and could be indicate by a more specific error message.
783
+ case '.' : // [core#611]:
784
+ t = _parseFloatThatStartsWithPeriod ();
785
+ break ;
783
786
case '0' :
784
787
case '1' :
785
788
case '2' :
@@ -845,6 +848,8 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
845
848
846
849
// Should we have separate handling for plus? Although it is not allowed per se,
847
850
// it may be erroneously used, and could be indicate by a more specific error message.
851
+ case '.' : // [core#611]:
852
+ return (_currToken = _parseFloatThatStartsWithPeriod ());
848
853
case '0' :
849
854
case '1' :
850
855
case '2' :
@@ -1046,6 +1051,9 @@ public String nextFieldName() throws IOException
1046
1051
case '-' :
1047
1052
t = _parseNegNumber ();
1048
1053
break ;
1054
+ case '.' : // [core#611]:
1055
+ t = _parseFloatThatStartsWithPeriod ();
1056
+ break ;
1049
1057
case '0' :
1050
1058
case '1' :
1051
1059
case '2' :
@@ -1164,6 +1172,9 @@ private final void _isNextTokenNameYes(int i) throws IOException
1164
1172
case '-' :
1165
1173
_nextToken = _parseNegNumber ();
1166
1174
return ;
1175
+ case '.' : // [core#611]:
1176
+ _nextToken = _parseFloatThatStartsWithPeriod ();
1177
+ return ;
1167
1178
case '0' :
1168
1179
case '1' :
1169
1180
case '2' :
@@ -1221,6 +1232,9 @@ private final boolean _isNextTokenNameMaybe(int i, SerializableString str) throw
1221
1232
case '-' :
1222
1233
t = _parseNegNumber ();
1223
1234
break ;
1235
+ case '.' : // [core#611]:
1236
+ t = _parseFloatThatStartsWithPeriod ();
1237
+ break ;
1224
1238
case '0' :
1225
1239
case '1' :
1226
1240
case '2' :
@@ -1352,6 +1366,17 @@ public Boolean nextBooleanValue() throws IOException
1352
1366
/**********************************************************
1353
1367
*/
1354
1368
1369
+ // @since 2.11, [core#611]
1370
+ protected final JsonToken _parseFloatThatStartsWithPeriod () throws IOException
1371
+ {
1372
+ // [core#611]: allow optionally leading decimal point
1373
+ if (!isEnabled (JsonReadFeature .ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS .mappedFeature ())) {
1374
+ return _handleUnexpectedValue (INT_PERIOD );
1375
+ }
1376
+ return _parseFloat (_textBuffer .emptyAndGetCurrentSegment (),
1377
+ 0 , INT_PERIOD , false , 0 );
1378
+ }
1379
+
1355
1380
/**
1356
1381
* Initial parsing method for number values. It needs to be able
1357
1382
* to parse enough input to be able to determine whether the
@@ -1538,7 +1563,7 @@ private final int _verifyNoLeadingZeroes() throws IOException
1538
1563
}
1539
1564
return ch ;
1540
1565
}
1541
-
1566
+
1542
1567
private final JsonToken _parseFloat (char [] outBuf , int outPtr , int c ,
1543
1568
boolean negative , int integerPartLength ) throws IOException
1544
1569
{
0 commit comments