Skip to content

Commit

Permalink
Merge branch '2.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 14, 2020
2 parents 75bc339 + d0d5656 commit 82fc183
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ public Byte deserialize(JsonParser p, DeserializationContext ctxt) throws IOExce
return p.getByteValue();
}
if (_primitive) {
return _parseBytePrimitive(ctxt, p);
return _parseBytePrimitive(p, ctxt);
}
return _parseByte(ctxt, p);
return _parseByte(p, ctxt);
}

protected Byte _parseByte(DeserializationContext ctxt, JsonParser p)
protected Byte _parseByte(JsonParser p, DeserializationContext ctxt)
throws IOException
{
CoercionAction act;
Expand Down Expand Up @@ -293,7 +293,7 @@ protected Byte _parseByte(DeserializationContext ctxt, JsonParser p)
}
return Byte.valueOf((byte) value);
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (Byte) getNullValue(ctxt);
}
Expand Down Expand Up @@ -332,7 +332,7 @@ public Short deserialize(JsonParser p, DeserializationContext ctxt)
return p.getShortValue();
}
if (_primitive) {
return _parseShortPrimitive(ctxt, p);
return _parseShortPrimitive(p, ctxt);
}
return _parseShort(ctxt, p);
}
Expand Down Expand Up @@ -369,7 +369,7 @@ protected Short _parseShort(DeserializationContext ctxt, JsonParser p)
}
return (short) value;
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (Short) getNullValue(ctxt);
}
Expand Down Expand Up @@ -470,7 +470,7 @@ public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
return p.getIntValue();
}
if (_primitive) {
return _parseIntPrimitive(ctxt, p);
return _parseIntPrimitive(p, ctxt);
}
return _parseInteger(ctxt, p);
}
Expand All @@ -485,7 +485,7 @@ public Integer deserializeWithType(JsonParser p, DeserializationContext ctxt,
return p.getIntValue();
}
if (_primitive) {
return _parseIntPrimitive(ctxt, p);
return _parseIntPrimitive(p, ctxt);
}
return _parseInteger(ctxt, p);
}
Expand Down Expand Up @@ -525,7 +525,7 @@ protected final Integer _parseInteger(DeserializationContext ctxt, JsonParser p)
"not a valid Integer value");
}
case JsonTokenId.ID_NUMBER_FLOAT: // coercing may work too
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (Integer) getNullValue(ctxt);
}
Expand Down Expand Up @@ -564,7 +564,7 @@ public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOExce
return p.getLongValue();
}
if (_primitive) {
return _parseLongPrimitive(ctxt, p);
return _parseLongPrimitive(p, ctxt);
}
return _parseLong(ctxt, p);
}
Expand Down Expand Up @@ -594,7 +594,7 @@ protected final Long _parseLong(DeserializationContext ctxt, JsonParser p)
return (Long) ctxt.handleWeirdStringValue(_valueClass, text,
"not a valid Long value");
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (Long) getNullValue(ctxt);
}
Expand Down Expand Up @@ -632,7 +632,7 @@ public Float deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc
return p.getFloatValue();
}
if (_primitive) {
return _parseFloatPrimitive(ctxt, p);
return _parseFloatPrimitive(p, ctxt);
}
return _parseFloat(p, ctxt);
}
Expand Down Expand Up @@ -707,7 +707,7 @@ public Double deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
return p.getDoubleValue();
}
if (_primitive) {
return _parseDoublePrimitive(ctxt, p);
return _parseDoublePrimitive(p, ctxt);
}
return _parseDouble(p, ctxt);
}
Expand All @@ -722,7 +722,7 @@ public Double deserializeWithType(JsonParser p, DeserializationContext ctxt,
return p.getDoubleValue();
}
if (_primitive) {
return _parseDoublePrimitive(ctxt, p);
return _parseDoublePrimitive(p, ctxt);
}
return _parseDouble(p, ctxt);
}
Expand Down Expand Up @@ -942,7 +942,7 @@ public BigInteger deserialize(JsonParser p, DeserializationContext ctxt) throws
}
break;
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (BigInteger) getNullValue(ctxt);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public byte[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
_verifyNullForPrimitive(ctxt);
value = (byte) 0;
} else {
value = _parseBytePrimitive(ctxt, p);
value = _parseBytePrimitive(p, ctxt);
}
}
if (ix >= chunk.length) {
Expand Down Expand Up @@ -582,7 +582,7 @@ public short[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
_verifyNullForPrimitive(ctxt);
value = (short) 0;
} else {
value = _parseShortPrimitive(ctxt, p);
value = _parseShortPrimitive(p, ctxt);
}
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
Expand All @@ -599,7 +599,7 @@ public short[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
@Override
protected short[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new short[] { _parseShortPrimitive(ctxt, p) };
return new short[] { _parseShortPrimitive(p, ctxt) };
}

@Override
Expand Down Expand Up @@ -658,7 +658,7 @@ public int[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc
_verifyNullForPrimitive(ctxt);
value = 0;
} else {
value = _parseIntPrimitive(ctxt, p);
value = _parseIntPrimitive(p, ctxt);
}
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
Expand All @@ -675,7 +675,7 @@ public int[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc
@Override
protected int[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new int[] { _parseIntPrimitive(ctxt, p) };
return new int[] { _parseIntPrimitive(p, ctxt) };
}

@Override
Expand Down Expand Up @@ -734,7 +734,7 @@ public long[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
_verifyNullForPrimitive(ctxt);
value = 0L;
} else {
value = _parseLongPrimitive(ctxt, p);
value = _parseLongPrimitive(p, ctxt);
}
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
Expand All @@ -751,7 +751,7 @@ public long[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
@Override
protected long[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new long[] { _parseLongPrimitive(ctxt, p) };
return new long[] { _parseLongPrimitive(p, ctxt) };
}

@Override
Expand Down Expand Up @@ -804,7 +804,7 @@ public float[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
continue;
}
}
float value = _parseFloatPrimitive(ctxt, p);
float value = _parseFloatPrimitive(p, ctxt);
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
ix = 0;
Expand All @@ -820,7 +820,7 @@ public float[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
@Override
protected float[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new float[] { _parseFloatPrimitive(ctxt, p) };
return new float[] { _parseFloatPrimitive(p, ctxt) };
}

@Override
Expand Down Expand Up @@ -872,7 +872,7 @@ public double[] deserialize(JsonParser p, DeserializationContext ctxt) throws IO
continue;
}
}
double value = _parseDoublePrimitive(ctxt, p);
double value = _parseDoublePrimitive(p, ctxt);
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
ix = 0;
Expand All @@ -888,7 +888,7 @@ public double[] deserialize(JsonParser p, DeserializationContext ctxt) throws IO
@Override
protected double[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new double[] { _parseDoublePrimitive(ctxt, p) };
return new double[] { _parseDoublePrimitive(p, ctxt) };
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt)
if (t.isNumeric()) {
lineNumber = p.getIntValue();
} else {
lineNumber = _parseIntPrimitive(ctxt, p);
lineNumber = _parseIntPrimitive(p, ctxt);
}
break;
case "methodName":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.fasterxml.jackson.core.JsonParser.NumberType;
import com.fasterxml.jackson.core.exc.InputCoercionException;
import com.fasterxml.jackson.core.io.NumberInput;

import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.cfg.CoercionAction;
Expand Down Expand Up @@ -427,7 +426,7 @@ protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt,
return (Boolean) ctxt.handleUnexpectedToken(ctxt.constructType(targetType), p);
}

protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser p)
protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final JsonToken t = p.currentToken();
Expand Down Expand Up @@ -468,7 +467,7 @@ protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser
return (byte) value;
}
if (t == JsonToken.VALUE_NUMBER_FLOAT) {
CoercionAction act = _checkFloatToIntCoercion(ctxt, p, Byte.TYPE);
CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Byte.TYPE);
if (act == CoercionAction.AsNull) {
return (byte) 0;
}
Expand All @@ -480,14 +479,14 @@ protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser
// 12-Jun-2020, tatu: For some reason calling `_deserializeFromArray()` won't work so:
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final byte parsed = _parseBytePrimitive(ctxt, p);
final byte parsed = _parseBytePrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
return ((Byte) ctxt.handleUnexpectedToken(ctxt.constructType(Byte.TYPE), p)).byteValue();
}

protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonParser p)
protected final short _parseShortPrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final JsonToken t = p.currentToken();
Expand Down Expand Up @@ -525,7 +524,7 @@ protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonPars
return (short) value;
}
if (t == JsonToken.VALUE_NUMBER_FLOAT) {
CoercionAction act = _checkFloatToIntCoercion(ctxt, p, Short.TYPE);
CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Short.TYPE);
if (act == CoercionAction.AsNull) {
return (short) 0;
}
Expand All @@ -537,14 +536,14 @@ protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonPars
// 12-Jun-2020, tatu: For some reason calling `_deserializeFromArray()` won't work so:
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final short parsed = _parseShortPrimitive(ctxt, p);
final short parsed = _parseShortPrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
return ((Short) ctxt.handleUnexpectedToken(ctxt.constructType(Short.TYPE), p)).shortValue();
}

protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p)
protected final int _parseIntPrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
CoercionAction act;
Expand All @@ -571,7 +570,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p
}
return _parseIntPrimitive(ctxt, text);
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, Integer.TYPE);
act = _checkFloatToIntCoercion(p, ctxt, Integer.TYPE);
if (act == CoercionAction.AsNull) {
return 0;
}
Expand All @@ -582,7 +581,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p
case JsonTokenId.ID_START_ARRAY:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final int parsed = _parseIntPrimitive(ctxt, p);
final int parsed = _parseIntPrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
Expand Down Expand Up @@ -614,7 +613,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, String text)
}
}

protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser p)
protected final long _parseLongPrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
CoercionAction act;
Expand All @@ -641,7 +640,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser
}
return _parseLongPrimitive(ctxt, text);
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, Long.TYPE);
act = _checkFloatToIntCoercion(p, ctxt, Long.TYPE);
if (act == CoercionAction.AsNull) {
return 0L;
}
Expand All @@ -652,7 +651,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser
case JsonTokenId.ID_START_ARRAY:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final long parsed = _parseLongPrimitive(ctxt, p);
final long parsed = _parseLongPrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
Expand All @@ -674,7 +673,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, String tex
}
}

protected final float _parseFloatPrimitive(DeserializationContext ctxt, JsonParser p)
protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
CoercionAction act;
Expand Down Expand Up @@ -704,7 +703,7 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, JsonPars
case JsonTokenId.ID_START_ARRAY:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final float parsed = _parseFloatPrimitive(ctxt, p);
final float parsed = _parseFloatPrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
Expand Down Expand Up @@ -742,7 +741,7 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, String t
return _nonNullNumber(v).floatValue();
}

protected final double _parseDoublePrimitive(DeserializationContext ctxt, JsonParser p)
protected final double _parseDoublePrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
CoercionAction act;
Expand Down Expand Up @@ -772,7 +771,7 @@ protected final double _parseDoublePrimitive(DeserializationContext ctxt, JsonPa
case JsonTokenId.ID_START_ARRAY:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final double parsed = _parseDoublePrimitive(ctxt, p);
final double parsed = _parseDoublePrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
Expand Down Expand Up @@ -1015,7 +1014,7 @@ protected CoercionAction _checkFromStringCoercion(DeserializationContext ctxt, S
/**
* @since 2.12
*/
protected CoercionAction _checkFloatToIntCoercion(DeserializationContext ctxt, JsonParser p,
protected CoercionAction _checkFloatToIntCoercion(JsonParser p, DeserializationContext ctxt,
Class<?> rawTargetType)
throws IOException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public OptionalInt deserialize(JsonParser p, DeserializationContext ctxt) throws
}
return OptionalInt.of(_parseIntPrimitive(ctxt, text));
case JsonTokenId.ID_NUMBER_FLOAT:
act = _checkFloatToIntCoercion(ctxt, p, _valueClass);
act = _checkFloatToIntCoercion(p, ctxt, _valueClass);
if (act == CoercionAction.AsNull) {
return (OptionalInt) getNullValue(ctxt);
}
Expand Down
Loading

0 comments on commit 82fc183

Please sign in to comment.