Skip to content

Commit

Permalink
more work for #611
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 23, 2020
1 parent 4cec80a commit c3a9b5e
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -757,6 +757,9 @@ public final JsonToken nextToken() throws IOException
*/
t = _parseNegNumber();
break;
case '.': // [core#61]]
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -950,6 +953,9 @@ public String nextFieldName() throws IOException
case '-':
t = _parseNegNumber();
break;
case '.': // [core#61]]
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1019,6 +1025,9 @@ private final void _isNextTokenNameYes(int i) throws IOException
case '-':
_nextToken = _parseNegNumber();
return;
case '.': // [core#61]]
_nextToken = _parseFloatThatStartsWithPeriod();
return;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1054,6 +1063,9 @@ protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws IOExce
case '-':
t = _parseNegNumber();
break;
case '.': // [core#61]]
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1120,6 +1132,8 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
* it is not allowed per se, it may be erroneously used,
* and could be indicated by a more specific error message.
*/
case '.': // [core#61]]
return (_currToken = _parseFloatThatStartsWithPeriod());
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1258,6 +1272,16 @@ public final Boolean nextBooleanValue() throws IOException
/**********************************************************
*/

// @since 2.11, [core#611]
protected final JsonToken _parseFloatThatStartsWithPeriod() throws IOException
{
// [core#611]: allow optionally leading decimal point
if (!isEnabled(JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature())) {
return _handleOddValue('.');
}
return _parseFloat(INT_PERIOD, _inputPtr-1, _inputPtr, false, 0);
}

/**
* Initial parsing method for number values. It needs to be able
* to parse enough input to be able to determine whether the
Expand Down

0 comments on commit c3a9b5e

Please sign in to comment.