Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext
_verifyNullForPrimitiveCoercion(ctxt, text);
return 0.0f;
}
return _parseFloatPrimitive(ctxt, text);
return _parseFloatPrimitive(p, ctxt, text);
}

/**
Expand All @@ -1047,6 +1047,20 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, String t
return _nonNullNumber(v).floatValue();
}

/**
* @since 2.14
*/
protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext ctxt, String text)
throws IOException
{
try {
return NumberInput.parseFloat(text, p.isEnabled(StreamReadFeature.USE_FAST_DOUBLE_PARSER));
} catch (IllegalArgumentException iae) { }
Number v = (Number) ctxt.handleWeirdStringValue(Float.TYPE, text,
"not a valid `float` value");
return _nonNullNumber(v).floatValue();
}

/**
* Helper method called to check whether given String value contains one of
* "special" values (currently, NaN ("not-a-number") and plus/minus Infinity)
Expand Down Expand Up @@ -1137,7 +1151,7 @@ protected final double _parseDoublePrimitive(JsonParser p, DeserializationContex
_verifyNullForPrimitiveCoercion(ctxt, text);
return 0.0;
}
return _parseDoublePrimitive(ctxt, text);
return _parseDoublePrimitive(p, ctxt, text);
}

/**
Expand All @@ -1154,6 +1168,20 @@ protected final double _parseDoublePrimitive(DeserializationContext ctxt, String
return _nonNullNumber(v).doubleValue();
}

/**
* @since 2.14
*/
protected final double _parseDoublePrimitive(JsonParser p, DeserializationContext ctxt, String text)
throws IOException
{
try {
return _parseDouble(text, p.isEnabled(StreamReadFeature.USE_FAST_DOUBLE_PARSER));
} catch (IllegalArgumentException iae) { }
Number v = (Number) ctxt.handleWeirdStringValue(Double.TYPE, text,
"not a valid `double` value (as String to convert)");
return _nonNullNumber(v).doubleValue();
}

/**
* Helper method for encapsulating calls to low-level double value parsing; single place
* just because we need a work-around that must be applied to all calls.
Expand Down