From 359ad7186fad0a1066d25bf2337eb2e093dd959b Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 12 Jun 2020 19:18:58 -0700 Subject: [PATCH] ... --- .../databind/deser/std/NumberDeserializers.java | 12 ++++++------ .../jackson/databind/deser/jdk/JDKScalarsTest.java | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java index 739d40c0e2..9960c050d6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java @@ -266,9 +266,9 @@ public Byte deserialize(JsonParser p, DeserializationContext ctxt) throws IOExce if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getByteValue(); } -// if (_primitive) { -// return _parseBytePrimitive(ctxt, p, _valueClass); -// } + if (_primitive) { + return _parseBytePrimitive(ctxt, p, _valueClass); + } return _parseByte(ctxt, p, _valueClass); } } @@ -294,9 +294,9 @@ public Short deserialize(JsonParser p, DeserializationContext ctxt) if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) { return p.getShortValue(); } -// if (_primitive) { -// return _parseShortPrimitive(ctxt, p, _valueClass); -// } + if (_primitive) { + return _parseShortPrimitive(ctxt, p, _valueClass); + } return _parseShort(ctxt, p, _valueClass); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsTest.java index 57cfea2cb3..adef80dab7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsTest.java @@ -701,9 +701,11 @@ public void testEmptyStringFailForBooleanPrimitive() throws IOException public void testEmptyStringFailForPrimitives() throws IOException { - _verifyEmptyStringFailForPrimitives("byteValue"); + // 12-Jun-2020, tatu: Empty String coercion is not same as explicit + // `null`, so some of these do not apply: +// _verifyEmptyStringFailForPrimitives("byteValue"); _verifyEmptyStringFailForPrimitives("charValue"); - _verifyEmptyStringFailForPrimitives("shortValue"); +// _verifyEmptyStringFailForPrimitives("shortValue"); _verifyEmptyStringFailForPrimitives("intValue"); _verifyEmptyStringFailForPrimitives("longValue"); _verifyEmptyStringFailForPrimitives("floatValue");