Skip to content

Commit

Permalink
some more #611
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 23, 2020
1 parent 9cc36df commit 397bc5b
Showing 1 changed file with 26 additions and 1 deletion.
Expand Up @@ -780,6 +780,9 @@ public JsonToken nextToken() throws IOException

// Should we have separate handling for plus? Although it is not allowed per se,
// it may be erroneously used, and could be indicate by a more specific error message.
case '.': // [core#611]:
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -845,6 +848,8 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException

// Should we have separate handling for plus? Although it is not allowed per se,
// it may be erroneously used, and could be indicate by a more specific error message.
case '.': // [core#611]:
return (_currToken = _parseFloatThatStartsWithPeriod());
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1046,6 +1051,9 @@ public String nextFieldName() throws IOException
case '-':
t = _parseNegNumber();
break;
case '.': // [core#611]:
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1164,6 +1172,9 @@ private final void _isNextTokenNameYes(int i) throws IOException
case '-':
_nextToken = _parseNegNumber();
return;
case '.': // [core#611]:
_nextToken = _parseFloatThatStartsWithPeriod();
return;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1221,6 +1232,9 @@ private final boolean _isNextTokenNameMaybe(int i, SerializableString str) throw
case '-':
t = _parseNegNumber();
break;
case '.': // [core#611]:
t = _parseFloatThatStartsWithPeriod();
break;
case '0':
case '1':
case '2':
Expand Down Expand Up @@ -1352,6 +1366,17 @@ public 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 _handleUnexpectedValue(INT_PERIOD);
}
return _parseFloat(_textBuffer.emptyAndGetCurrentSegment(),
0, INT_PERIOD, 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 Expand Up @@ -1538,7 +1563,7 @@ private final int _verifyNoLeadingZeroes() throws IOException
}
return ch;
}

private final JsonToken _parseFloat(char[] outBuf, int outPtr, int c,
boolean negative, int integerPartLength) throws IOException
{
Expand Down

0 comments on commit 397bc5b

Please sign in to comment.