You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/OptimizedSettableBeanProperty.java
+25-4Lines changed: 25 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,13 @@ protected final boolean _deserializeBoolean(JsonParser p, DeserializationContext
178
178
JsonTokent = p.getCurrentToken();
179
179
if (t == JsonToken.VALUE_TRUE) returntrue;
180
180
if (t == JsonToken.VALUE_FALSE) returnfalse;
181
-
if (t == JsonToken.VALUE_NULL) returnfalse;
181
+
if (t == JsonToken.VALUE_NULL) {
182
+
if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) {
183
+
_failNullToPrimitiveCoercion(ctxt, "boolean");
184
+
} else {
185
+
returnfalse;
186
+
}
187
+
}
182
188
183
189
if (t == JsonToken.VALUE_NUMBER_INT) {
184
190
// 11-Jan-2012, tatus: May be outside of int...
@@ -264,7 +270,11 @@ protected final int _deserializeInt(JsonParser p, DeserializationContext ctxt)
264
270
returnp.getValueAsInt();
265
271
}
266
272
if (t == JsonToken.VALUE_NULL) {
267
-
return0;
273
+
if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) {
274
+
_failNullToPrimitiveCoercion(ctxt, "int");
275
+
} else {
276
+
return0;
277
+
}
268
278
}
269
279
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
270
280
p.nextToken();
@@ -300,7 +310,11 @@ protected final long _deserializeLong(JsonParser p, DeserializationContext ctxt)
300
310
} catch (IllegalArgumentExceptioniae) { }
301
311
throwctxt.weirdStringException(text, Long.TYPE, "not a valid long value");
302
312
caseJsonTokenId.ID_NULL:
303
-
return0L;
313
+
if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) {
314
+
_failNullToPrimitiveCoercion(ctxt, "long");
315
+
} else {
316
+
return0L;
317
+
}
304
318
caseJsonTokenId.ID_START_ARRAY:
305
319
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
306
320
p.nextToken();
@@ -368,7 +382,14 @@ protected final boolean _deserializeBooleanFromOther(JsonParser p, Deserializati
0 commit comments