@@ -1030,7 +1030,7 @@ protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext
1030
1030
_verifyNullForPrimitiveCoercion (ctxt , text );
1031
1031
return 0.0f ;
1032
1032
}
1033
- return _parseFloatPrimitive (ctxt , text );
1033
+ return _parseFloatPrimitive (p , ctxt , text );
1034
1034
}
1035
1035
1036
1036
/**
@@ -1047,6 +1047,20 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, String t
1047
1047
return _nonNullNumber (v ).floatValue ();
1048
1048
}
1049
1049
1050
+ /**
1051
+ * @since 2.14
1052
+ */
1053
+ protected final float _parseFloatPrimitive (JsonParser p , DeserializationContext ctxt , String text )
1054
+ throws IOException
1055
+ {
1056
+ try {
1057
+ return NumberInput .parseFloat (text , p .isEnabled (StreamReadFeature .USE_FAST_DOUBLE_PARSER ));
1058
+ } catch (IllegalArgumentException iae ) { }
1059
+ Number v = (Number ) ctxt .handleWeirdStringValue (Float .TYPE , text ,
1060
+ "not a valid `float` value" );
1061
+ return _nonNullNumber (v ).floatValue ();
1062
+ }
1063
+
1050
1064
/**
1051
1065
* Helper method called to check whether given String value contains one of
1052
1066
* "special" values (currently, NaN ("not-a-number") and plus/minus Infinity)
@@ -1137,7 +1151,7 @@ protected final double _parseDoublePrimitive(JsonParser p, DeserializationContex
1137
1151
_verifyNullForPrimitiveCoercion (ctxt , text );
1138
1152
return 0.0 ;
1139
1153
}
1140
- return _parseDoublePrimitive (ctxt , text );
1154
+ return _parseDoublePrimitive (p , ctxt , text );
1141
1155
}
1142
1156
1143
1157
/**
@@ -1154,6 +1168,20 @@ protected final double _parseDoublePrimitive(DeserializationContext ctxt, String
1154
1168
return _nonNullNumber (v ).doubleValue ();
1155
1169
}
1156
1170
1171
+ /**
1172
+ * @since 2.14
1173
+ */
1174
+ protected final double _parseDoublePrimitive (JsonParser p , DeserializationContext ctxt , String text )
1175
+ throws IOException
1176
+ {
1177
+ try {
1178
+ return _parseDouble (text , p .isEnabled (StreamReadFeature .USE_FAST_DOUBLE_PARSER ));
1179
+ } catch (IllegalArgumentException iae ) { }
1180
+ Number v = (Number ) ctxt .handleWeirdStringValue (Double .TYPE , text ,
1181
+ "not a valid `double` value (as String to convert)" );
1182
+ return _nonNullNumber (v ).doubleValue ();
1183
+ }
1184
+
1157
1185
/**
1158
1186
* Helper method for encapsulating calls to low-level double value parsing; single place
1159
1187
* just because we need a work-around that must be applied to all calls.
0 commit comments