From b869fdea5e85bc19e52e0e61fe33911a09c00f53 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" Date: Wed, 8 Jan 2025 23:53:41 +0900 Subject: [PATCH 1/9] change default `FAIL_ON_NULL_FOR_PRIMITIVES` --- .../java/tools/jackson/databind/DeserializationFeature.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tools/jackson/databind/DeserializationFeature.java b/src/main/java/tools/jackson/databind/DeserializationFeature.java index 1d9ce2ebe1..060ddb79b6 100644 --- a/src/main/java/tools/jackson/databind/DeserializationFeature.java +++ b/src/main/java/tools/jackson/databind/DeserializationFeature.java @@ -126,7 +126,7 @@ public enum DeserializationFeature implements ConfigFeature *

* Feature is enabled by default as of Jackson 3.0 (in 2.x it was disabled). */ - FAIL_ON_NULL_FOR_PRIMITIVES(false), + FAIL_ON_NULL_FOR_PRIMITIVES(true), /** * Feature that determines whether JSON integer numbers are valid From 6eabb6e5fbb9c88ff51758c676e74a547d95a323 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" Date: Thu, 9 Jan 2025 00:54:41 +0900 Subject: [PATCH 2/9] fix tests --- .../jackson/databind/big/BiggerDataTest.java | 4 +- .../convert/CoerceEmptyToInt3234Test.java | 7 ++-- .../convert/CoerceJDKScalarsTest.java | 1 + .../convert/CoerceStringToIntsTest.java | 1 + .../databind/convert/CoerceToBooleanTest.java | 4 +- .../convert/ScalarConversionTest.java | 4 +- .../builder/BuilderInfiniteLoop1979Test.java | 6 ++- .../deser/builder/BuilderWithViewTest.java | 1 + .../deser/creators/BigCreatorTest.java | 4 +- .../deser/creators/FailOnNullCreatorTest.java | 3 +- .../deser/creators/RequiredCreatorTest.java | 3 +- .../deser/creators/TestCreators2.java | 8 ++-- .../filter/NullConversionsForContentTest.java | 15 ++++--- .../deser/jdk/JDKNumberDeserTest.java | 41 ++++++++++--------- .../deser/jdk/JDKScalarsDeserTest.java | 4 +- .../databind/deser/merge/ArrayMergeTest.java | 1 + .../DefaultCreatorDetection4584Test.java | 1 + .../introspect/IsGetterRenaming2527Test.java | 1 + ...btypesExternalPropertyMissingProperty.java | 6 ++- .../databind/module/SimpleModuleTest.java | 2 + .../RecordDeserialization3906Test.java | 20 ++++++--- .../records/RecordExplicitCreatorsTest.java | 1 + .../records/RecordNullHandling3847Test.java | 10 ++++- .../records/RecordWithJsonIgnoreTest.java | 6 ++- .../records/RecordWithReadOnlyTest.java | 5 ++- .../struct/TestPOJOAsArrayAdvanced.java | 2 + .../struct/TestPOJOAsArrayWithBuilder.java | 4 +- .../struct/UnwrapSingleArrayScalarsTest.java | 1 + .../views/ViewDeserializationTest.java | 3 ++ 29 files changed, 118 insertions(+), 51 deletions(-) diff --git a/src/test/java/tools/jackson/databind/big/BiggerDataTest.java b/src/test/java/tools/jackson/databind/big/BiggerDataTest.java index 0cfd9418c6..043b2e4191 100644 --- a/src/test/java/tools/jackson/databind/big/BiggerDataTest.java +++ b/src/test/java/tools/jackson/databind/big/BiggerDataTest.java @@ -78,7 +78,9 @@ static class Area { /********************************************************** */ - private final ObjectMapper MAPPER = JsonMapper.builder().build(); + private final ObjectMapper MAPPER = JsonMapper.builder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); @Test public void testReading() throws Exception diff --git a/src/test/java/tools/jackson/databind/convert/CoerceEmptyToInt3234Test.java b/src/test/java/tools/jackson/databind/convert/CoerceEmptyToInt3234Test.java index f80192e59e..cef530927e 100644 --- a/src/test/java/tools/jackson/databind/convert/CoerceEmptyToInt3234Test.java +++ b/src/test/java/tools/jackson/databind/convert/CoerceEmptyToInt3234Test.java @@ -6,8 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import static tools.jackson.databind.testutil.DatabindTestUtil.a2q; -import static tools.jackson.databind.testutil.DatabindTestUtil.newJsonMapper; +import static tools.jackson.databind.testutil.DatabindTestUtil.*; // [databind#3234] public class CoerceEmptyToInt3234Test @@ -24,7 +23,9 @@ static class BasicDoubleWrapper { public double value = -1.25; } - private final ObjectMapper MAPPER = newJsonMapper(); + private final ObjectMapper MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); private final ObjectReader READER_INT_BASIC = MAPPER.readerFor(BasicIntWrapper.class); private final ObjectReader READER_LONG_BASIC = MAPPER.readerFor(BasicLongWrapper.class); private final ObjectReader READER_DOUBLE_BASIC = MAPPER.readerFor(BasicDoubleWrapper.class); diff --git a/src/test/java/tools/jackson/databind/convert/CoerceJDKScalarsTest.java b/src/test/java/tools/jackson/databind/convert/CoerceJDKScalarsTest.java index 2565348002..94d9815bb9 100644 --- a/src/test/java/tools/jackson/databind/convert/CoerceJDKScalarsTest.java +++ b/src/test/java/tools/jackson/databind/convert/CoerceJDKScalarsTest.java @@ -86,6 +86,7 @@ private void _verifyNullOkFromEmpty(Class type, Object exp) throws IOExceptio { Object result = COERCING_MAPPER.readerFor(type) .with(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue("\"\""); if (exp == null) { assertNull(result); diff --git a/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java b/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java index 187dbc6858..8611c328ea 100644 --- a/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java +++ b/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java @@ -36,6 +36,7 @@ public class CoerceStringToIntsTest private final ObjectMapper MAPPER_TO_NULL = jsonMapperBuilder() .withCoercionConfig(LogicalType.Integer, cfg -> cfg.setCoercion(CoercionInputShape.String, CoercionAction.AsNull)) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); private final ObjectMapper MAPPER_TO_FAIL = jsonMapperBuilder() diff --git a/src/test/java/tools/jackson/databind/convert/CoerceToBooleanTest.java b/src/test/java/tools/jackson/databind/convert/CoerceToBooleanTest.java index 05cc775911..47dfeb1378 100644 --- a/src/test/java/tools/jackson/databind/convert/CoerceToBooleanTest.java +++ b/src/test/java/tools/jackson/databind/convert/CoerceToBooleanTest.java @@ -52,7 +52,9 @@ public BooleanWrapper(@JsonProperty("ctor") Boolean foo) { public void setPrimitive(boolean v) { primitive = v; } } - private final ObjectMapper DEFAULT_MAPPER = newJsonMapper(); + private final ObjectMapper DEFAULT_MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); private final ObjectMapper LEGACY_NONCOERCING_MAPPER = jsonMapperBuilder() .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) diff --git a/src/test/java/tools/jackson/databind/convert/ScalarConversionTest.java b/src/test/java/tools/jackson/databind/convert/ScalarConversionTest.java index 115a604393..2190691656 100644 --- a/src/test/java/tools/jackson/databind/convert/ScalarConversionTest.java +++ b/src/test/java/tools/jackson/databind/convert/ScalarConversionTest.java @@ -10,7 +10,9 @@ public class ScalarConversionTest { - private final ObjectMapper MAPPER = newJsonMapper(); + private final ObjectMapper MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); // [databind#1433] @Test diff --git a/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java b/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java index 684e5a5b57..ebf5bd36ad 100644 --- a/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java +++ b/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java @@ -7,11 +7,13 @@ import tools.jackson.databind.*; import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.testutil.DatabindTestUtil; import static org.junit.jupiter.api.Assertions.assertNotNull; //first for [databind#1978] but follow up for [databind#1979] public class BuilderInfiniteLoop1979Test + extends DatabindTestUtil { static class Builder { @@ -93,7 +95,9 @@ static class SubBean public void testInfiniteLoop1978() throws Exception { String json = "{\"sub.el1\":34,\"sub.el2\":\"some text\"}"; - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); Bean bean = mapper.readValue( json, Bean.class ); assertNotNull(bean); } diff --git a/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java b/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java index bc0d92fad4..619328527b 100644 --- a/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java +++ b/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java @@ -86,6 +86,7 @@ public CreatorValueXY build() { private final ObjectMapper MAPPER = jsonMapperBuilder() .disable(DeserializationFeature.FAIL_ON_UNEXPECTED_VIEW_PROPERTIES) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); @Test diff --git a/src/test/java/tools/jackson/databind/deser/creators/BigCreatorTest.java b/src/test/java/tools/jackson/databind/deser/creators/BigCreatorTest.java index aecbce18f6..2e34b43038 100644 --- a/src/test/java/tools/jackson/databind/deser/creators/BigCreatorTest.java +++ b/src/test/java/tools/jackson/databind/deser/creators/BigCreatorTest.java @@ -50,7 +50,9 @@ public Biggie( } } - private final ObjectReader BIGGIE_READER = sharedMapper().readerFor(Biggie.class); + private final ObjectReader BIGGIE_READER = sharedMapper() + .readerFor(Biggie.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); @Test public void testBigPartial() throws Exception diff --git a/src/test/java/tools/jackson/databind/deser/creators/FailOnNullCreatorTest.java b/src/test/java/tools/jackson/databind/deser/creators/FailOnNullCreatorTest.java index cdf1aa7799..d52e5b83f0 100644 --- a/src/test/java/tools/jackson/databind/deser/creators/FailOnNullCreatorTest.java +++ b/src/test/java/tools/jackson/databind/deser/creators/FailOnNullCreatorTest.java @@ -32,7 +32,8 @@ public Person(@JsonProperty(value="name") String name, } } - private final ObjectReader POINT_READER = sharedMapper().readerFor(Person.class); + private final ObjectReader POINT_READER = sharedMapper().readerFor(Person.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); @Test public void testRequiredNonNullParam() throws Exception diff --git a/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java b/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java index 7b902795e9..0dea2935f8 100644 --- a/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java +++ b/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java @@ -63,7 +63,8 @@ public void setUserType(String userType) { */ private final ObjectMapper MAPPER = newJsonMapper(); - private final ObjectReader POINT_READER = MAPPER.readerFor(FascistPoint.class); + private final ObjectReader POINT_READER = MAPPER.readerFor(FascistPoint.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); @Test public void testRequiredAnnotatedParam() throws Exception diff --git a/src/test/java/tools/jackson/databind/deser/creators/TestCreators2.java b/src/test/java/tools/jackson/databind/deser/creators/TestCreators2.java index 3fb64e3841..d75a7fc162 100644 --- a/src/test/java/tools/jackson/databind/deser/creators/TestCreators2.java +++ b/src/test/java/tools/jackson/databind/deser/creators/TestCreators2.java @@ -18,8 +18,7 @@ import static org.junit.jupiter.api.Assertions.*; -import static tools.jackson.databind.testutil.DatabindTestUtil.q; -import static tools.jackson.databind.testutil.DatabindTestUtil.verifyException; +import static tools.jackson.databind.testutil.DatabindTestUtil.*; public class TestCreators2 { @@ -264,7 +263,10 @@ public void testSimpleConstructor() throws Exception @Test public void testMissingPrimitives() throws Exception { - Primitives p = MAPPER.readValue("{}", Primitives.class); + Primitives p = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build() + .readValue("{}", Primitives.class); assertFalse(p.b); assertEquals(0, p.x); assertEquals(0.0, p.d); diff --git a/src/test/java/tools/jackson/databind/deser/filter/NullConversionsForContentTest.java b/src/test/java/tools/jackson/databind/deser/filter/NullConversionsForContentTest.java index 2bc1076313..b14591ffdf 100644 --- a/src/test/java/tools/jackson/databind/deser/filter/NullConversionsForContentTest.java +++ b/src/test/java/tools/jackson/databind/deser/filter/NullConversionsForContentTest.java @@ -273,24 +273,27 @@ public void testNullsAsEmptyWithPrimitiveArrays() throws Exception // int[] { - NullContentAsEmpty result = MAPPER.readValue(JSON, - new TypeReference>() { }); + NullContentAsEmpty result = MAPPER.readerFor(new TypeReference>() { }) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .readValue(JSON); assertEquals(1, result.values.length); assertEquals(0, result.values[0]); } // long[] { - NullContentAsEmpty result = MAPPER.readValue(JSON, - new TypeReference>() { }); + NullContentAsEmpty result = MAPPER.readerFor(new TypeReference>() { }) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .readValue(JSON); assertEquals(1, result.values.length); assertEquals(0L, result.values[0]); } // boolean[] { - NullContentAsEmpty result = MAPPER.readValue(JSON, - new TypeReference>() { }); + NullContentAsEmpty result = MAPPER.readerFor(new TypeReference>() { }) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .readValue(JSON); assertEquals(1, result.values.length); assertFalse(result.values[0]); } diff --git a/src/test/java/tools/jackson/databind/deser/jdk/JDKNumberDeserTest.java b/src/test/java/tools/jackson/databind/deser/jdk/JDKNumberDeserTest.java index 3bd5aff38c..9449b26060 100644 --- a/src/test/java/tools/jackson/databind/deser/jdk/JDKNumberDeserTest.java +++ b/src/test/java/tools/jackson/databind/deser/jdk/JDKNumberDeserTest.java @@ -102,7 +102,7 @@ public MyBeanValue deserialize(JsonParser jp, DeserializationContext ctxt) /********************************************************************** */ - private final ObjectMapper MAPPER = new ObjectMapper(); + private final ObjectMapper MAPPER = newJsonMapper(); @Test public void testNaN() throws Exception @@ -147,31 +147,34 @@ public void testEmptyAsNumber() throws Exception @Test public void testTextualNullAsNumber() throws Exception { + ObjectMapper mapper = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); final String NULL_JSON = q("null"); - assertNull(MAPPER.readValue(NULL_JSON, Byte.class)); - assertNull(MAPPER.readValue(NULL_JSON, Short.class)); + assertNull(mapper.readValue(NULL_JSON, Byte.class)); + assertNull(mapper.readValue(NULL_JSON, Short.class)); // Character is bit special, can't do: -// assertNull(MAPPER.readValue(JSON, Character.class)); - assertNull(MAPPER.readValue(NULL_JSON, Integer.class)); - assertNull(MAPPER.readValue(NULL_JSON, Long.class)); - assertNull(MAPPER.readValue(NULL_JSON, Float.class)); - assertNull(MAPPER.readValue(NULL_JSON, Double.class)); - - assertEquals(Byte.valueOf((byte) 0), MAPPER.readValue(NULL_JSON, Byte.TYPE)); - assertEquals(Short.valueOf((short) 0), MAPPER.readValue(NULL_JSON, Short.TYPE)); +// assertNull(mapper.readValue(JSON, Character.class)); + assertNull(mapper.readValue(NULL_JSON, Integer.class)); + assertNull(mapper.readValue(NULL_JSON, Long.class)); + assertNull(mapper.readValue(NULL_JSON, Float.class)); + assertNull(mapper.readValue(NULL_JSON, Double.class)); + + assertEquals(Byte.valueOf((byte) 0), mapper.readValue(NULL_JSON, Byte.TYPE)); + assertEquals(Short.valueOf((short) 0), mapper.readValue(NULL_JSON, Short.TYPE)); // Character is bit special, can't do: -// assertEquals(Character.valueOf((char) 0), MAPPER.readValue(JSON, Character.TYPE)); - assertEquals(Integer.valueOf(0), MAPPER.readValue(NULL_JSON, Integer.TYPE)); - assertEquals(Long.valueOf(0L), MAPPER.readValue(NULL_JSON, Long.TYPE)); - assertEquals(Float.valueOf(0f), MAPPER.readValue(NULL_JSON, Float.TYPE)); - assertEquals(Double.valueOf(0d), MAPPER.readValue(NULL_JSON, Double.TYPE)); +// assertEquals(Character.valueOf((char) 0), mapper.readValue(JSON, Character.TYPE)); + assertEquals(Integer.valueOf(0), mapper.readValue(NULL_JSON, Integer.TYPE)); + assertEquals(Long.valueOf(0L), mapper.readValue(NULL_JSON, Long.TYPE)); + assertEquals(Float.valueOf(0f), mapper.readValue(NULL_JSON, Float.TYPE)); + assertEquals(Double.valueOf(0d), mapper.readValue(NULL_JSON, Double.TYPE)); - assertNull(MAPPER.readValue(NULL_JSON, BigInteger.class)); - assertNull(MAPPER.readValue(NULL_JSON, BigDecimal.class)); + assertNull(mapper.readValue(NULL_JSON, BigInteger.class)); + assertNull(mapper.readValue(NULL_JSON, BigDecimal.class)); // Also: verify failure for at least some try { - MAPPER.readerFor(Integer.TYPE).with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + mapper.readerFor(Integer.TYPE).with(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(NULL_JSON); fail("Should not have passed"); } catch (MismatchedInputException e) { diff --git a/src/test/java/tools/jackson/databind/deser/jdk/JDKScalarsDeserTest.java b/src/test/java/tools/jackson/databind/deser/jdk/JDKScalarsDeserTest.java index a39f7b019b..24f2f558d9 100644 --- a/src/test/java/tools/jackson/databind/deser/jdk/JDKScalarsDeserTest.java +++ b/src/test/java/tools/jackson/databind/deser/jdk/JDKScalarsDeserTest.java @@ -25,7 +25,9 @@ */ public class JDKScalarsDeserTest { - private final ObjectMapper MAPPER = newJsonMapper(); + private final ObjectMapper MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); private final static String NAN_STRING = "NaN"; diff --git a/src/test/java/tools/jackson/databind/deser/merge/ArrayMergeTest.java b/src/test/java/tools/jackson/databind/deser/merge/ArrayMergeTest.java index 1fac6c1b92..93061a6ff8 100644 --- a/src/test/java/tools/jackson/databind/deser/merge/ArrayMergeTest.java +++ b/src/test/java/tools/jackson/databind/deser/merge/ArrayMergeTest.java @@ -129,6 +129,7 @@ public void testByteArrayMerging() throws Exception MergedX input = new MergedX(new byte[] { 1, 2 }); MergedX result = MAPPER .readerFor(new TypeReference>() {}) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .withValueToUpdate(input) .readValue(a2q("{'value':[4, 6.0, null]}")); assertSame(input, result); diff --git a/src/test/java/tools/jackson/databind/introspect/DefaultCreatorDetection4584Test.java b/src/test/java/tools/jackson/databind/introspect/DefaultCreatorDetection4584Test.java index 9f980aeab2..6876cc12dc 100644 --- a/src/test/java/tools/jackson/databind/introspect/DefaultCreatorDetection4584Test.java +++ b/src/test/java/tools/jackson/databind/introspect/DefaultCreatorDetection4584Test.java @@ -189,6 +189,7 @@ public void testCanonicalConstructor2ArgPropertiesCreator() throws Exception assertEquals(POJO4584.factoryString(null), readerWith(new PrimaryCreatorFindingIntrospector(JsonCreator.Mode.PROPERTIES, String.class, Integer.TYPE)) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{}"))); } diff --git a/src/test/java/tools/jackson/databind/introspect/IsGetterRenaming2527Test.java b/src/test/java/tools/jackson/databind/introspect/IsGetterRenaming2527Test.java index 2ae2672d2d..9eb59d5b07 100644 --- a/src/test/java/tools/jackson/databind/introspect/IsGetterRenaming2527Test.java +++ b/src/test/java/tools/jackson/databind/introspect/IsGetterRenaming2527Test.java @@ -91,6 +91,7 @@ protected String stdManglePropertyName(final String basename, final int offset) private final ObjectMapper MAPPER = jsonMapperBuilder() .annotationIntrospector(new MyIntrospector()) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); @Test diff --git a/src/test/java/tools/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java b/src/test/java/tools/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java index 67217f3caa..68dc73e571 100644 --- a/src/test/java/tools/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java +++ b/src/test/java/tools/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java @@ -127,9 +127,11 @@ public static Orange getOrange(@JsonProperty("name") String name, @JsonProperty( { final ObjectMapper mapper = new ObjectMapper(); BOX_READER_PASS = mapper.readerFor(Box.class) - .without(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY); + .without(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); BOX_READER_FAIL = mapper.readerFor(Box.class) - .with(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY); + .with(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); } /** diff --git a/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java b/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java index 5be9c2e7e9..ea3680561c 100644 --- a/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java @@ -214,6 +214,8 @@ public void testWithoutModule() .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) // since 3.0 not enabled by default .enable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + // since 3.0 enabled by default + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); // first: serialization failure: try { diff --git a/src/test/java/tools/jackson/databind/records/RecordDeserialization3906Test.java b/src/test/java/tools/jackson/databind/records/RecordDeserialization3906Test.java index d83f075023..f721ef3dbd 100644 --- a/src/test/java/tools/jackson/databind/records/RecordDeserialization3906Test.java +++ b/src/test/java/tools/jackson/databind/records/RecordDeserialization3906Test.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.PropertyAccessor; +import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.ObjectMapper; import tools.jackson.databind.cfg.MapperConfig; import tools.jackson.databind.introspect.AnnotatedClass; @@ -60,7 +61,8 @@ private record PrivateRecord3906(String string, int integer) { @Test public void testEmptyJsonToRecordWorkAround() throws Exception { ObjectMapper mapper = jsonMapperBuilder() - .changeDefaultVisibility(vc -> + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .changeDefaultVisibility(vc -> vc.withVisibility(PropertyAccessor.ALL, Visibility.NONE) .withVisibility(PropertyAccessor.CREATOR, Visibility.ANY)) .build(); @@ -72,7 +74,8 @@ public void testEmptyJsonToRecordWorkAround() throws Exception { @Test public void testEmptyJsonToRecordCreatorsVisible() throws Exception { ObjectMapper mapper = jsonMapperBuilder() - .changeDefaultVisibility(vc -> + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .changeDefaultVisibility(vc -> vc.withVisibility(PropertyAccessor.CREATOR, Visibility.NON_PRIVATE)) .build(); @@ -97,7 +100,9 @@ public VisibilityChecker findAutoDetectVisibility(MapperConfig cfg, } }); } - }).build(); + }) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); Record3906 recordDeser = mapper.readValue("{}", Record3906.class); assertEquals(new Record3906(null, 0), recordDeser); @@ -105,7 +110,9 @@ public VisibilityChecker findAutoDetectVisibility(MapperConfig cfg, @Test public void testEmptyJsonToRecordDirectAutoDetectConfig() throws Exception { - ObjectMapper mapper = newJsonMapper(); + ObjectMapper mapper = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); Record3906Annotated recordDeser = mapper.readValue("{}", Record3906Annotated.class); assertEquals(new Record3906Annotated(null, 0), recordDeser); @@ -113,7 +120,9 @@ public void testEmptyJsonToRecordDirectAutoDetectConfig() throws Exception { @Test public void testEmptyJsonToRecordJsonCreator() throws Exception { - ObjectMapper mapper = newJsonMapper(); + ObjectMapper mapper = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); Record3906Creator recordDeser = mapper.readValue("{}", Record3906Creator.class); assertEquals(new Record3906Creator(null, 0), recordDeser); @@ -143,6 +152,7 @@ public VisibilityChecker findAutoDetectVisibility(MapperConfig cfg, }); } }) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); assertEquals(new Record3906(null, 0), diff --git a/src/test/java/tools/jackson/databind/records/RecordExplicitCreatorsTest.java b/src/test/java/tools/jackson/databind/records/RecordExplicitCreatorsTest.java index fb0293a568..217d7ec4e8 100644 --- a/src/test/java/tools/jackson/databind/records/RecordExplicitCreatorsTest.java +++ b/src/test/java/tools/jackson/databind/records/RecordExplicitCreatorsTest.java @@ -108,6 +108,7 @@ public static RecordWithExplicitFactoryMethod valueOf(String value) { private final ObjectMapper MAPPER = jsonMapperBuilder() .disable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS) // So that test cases don't have to assert weird error messages .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); /* diff --git a/src/test/java/tools/jackson/databind/records/RecordNullHandling3847Test.java b/src/test/java/tools/jackson/databind/records/RecordNullHandling3847Test.java index 533e7fcc7a..533a17eb20 100644 --- a/src/test/java/tools/jackson/databind/records/RecordNullHandling3847Test.java +++ b/src/test/java/tools/jackson/databind/records/RecordNullHandling3847Test.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.Nulls; +import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.ObjectMapper; import tools.jackson.databind.cfg.CoercionAction; import tools.jackson.databind.cfg.CoercionInputShape; @@ -43,6 +44,10 @@ public record FixedRecord(@JsonProperty("field_name") String fieldName) {} .withCoercionConfigDefaults(config -> config.setCoercion(CoercionInputShape.String, CoercionAction.Fail)) .build(); + private final ObjectMapper DEFAULT_MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); + @Test public void testPojoNullHandlingValid() throws Exception { Pojo3847 pojo = NULL_MAPPER.readValue(a2q("{'fieldName': 'value'}"), Pojo3847.class); // expected @@ -118,13 +123,14 @@ public void testRecordFixerNullHandlingEmptyJson() throws Exception { @Test public void testRecordDefaultNullDeserialization() throws Exception { - PlainRecord pr = new ObjectMapper().readValue("{}", PlainRecord.class); + PlainRecord pr = DEFAULT_MAPPER.readValue("{}", PlainRecord.class); assertNull(pr.fieldName); } @Test public void testIntRecordDefaultNullDeserialization() throws Exception { - IntRecord ir = new ObjectMapper().readValue("{}", IntRecord.class); + IntRecord ir = DEFAULT_MAPPER.readerFor(IntRecord.class) + .readValue("{}"); assertNull(ir.description); assertEquals(0, ir.value); } diff --git a/src/test/java/tools/jackson/databind/records/RecordWithJsonIgnoreTest.java b/src/test/java/tools/jackson/databind/records/RecordWithJsonIgnoreTest.java index f8188a220d..25affff988 100644 --- a/src/test/java/tools/jackson/databind/records/RecordWithJsonIgnoreTest.java +++ b/src/test/java/tools/jackson/databind/records/RecordWithJsonIgnoreTest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.ObjectMapper; import tools.jackson.databind.testutil.DatabindTestUtil; @@ -104,7 +105,10 @@ public void testSerializeJsonIgnorePrimitiveTypeRecord() throws Exception { @Test public void testDeserializeJsonIgnorePrimitiveTypeRecord() throws Exception { - RecordWithIgnorePrimitiveType value = MAPPER.readValue("{\"id\":123,\"name\":\"Bob\"}", RecordWithIgnorePrimitiveType.class); + RecordWithIgnorePrimitiveType value = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build() + .readValue("{\"id\":123,\"name\":\"Bob\"}", RecordWithIgnorePrimitiveType.class); assertEquals(new RecordWithIgnorePrimitiveType(0, "Bob"), value); } } diff --git a/src/test/java/tools/jackson/databind/records/RecordWithReadOnlyTest.java b/src/test/java/tools/jackson/databind/records/RecordWithReadOnlyTest.java index 7150069cec..8a14825e49 100644 --- a/src/test/java/tools/jackson/databind/records/RecordWithReadOnlyTest.java +++ b/src/test/java/tools/jackson/databind/records/RecordWithReadOnlyTest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; +import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.ObjectMapper; import tools.jackson.databind.testutil.DatabindTestUtil; @@ -52,7 +53,9 @@ public RecordWithReadOnlyAllAndNoArgConstructor() { } } - private final ObjectMapper MAPPER = newJsonMapper(); + private final ObjectMapper MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); /* /********************************************************************** diff --git a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayAdvanced.java b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayAdvanced.java index 8f2b3c62cb..f97cbcc0bf 100644 --- a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayAdvanced.java +++ b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayAdvanced.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.*; +import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.MapperFeature; import tools.jackson.databind.ObjectMapper; import tools.jackson.databind.testutil.DatabindTestUtil; @@ -120,6 +121,7 @@ public void testWithViewAndCreator() throws Exception { AsArrayWithViewAndCreator result = MAPPER.readerFor(AsArrayWithViewAndCreator.class) .withView(ViewB.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue("[1,2,3]"); // should include 'c' (not view-able) and 'b' (include in ViewB) but not 'a' assertEquals(3, result.c); diff --git a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java index 0234a5e54d..4a0adadd5c 100644 --- a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java +++ b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java @@ -105,7 +105,9 @@ public CreatorValue build() { /***************************************************** */ - private final static ObjectMapper MAPPER = newJsonMapper(); + private final static ObjectMapper MAPPER = jsonMapperBuilder() + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .build(); @Test public void testSimpleBuilder() throws Exception diff --git a/src/test/java/tools/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java b/src/test/java/tools/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java index 5c36d81ad8..9ed91850a6 100644 --- a/src/test/java/tools/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java +++ b/src/test/java/tools/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java @@ -40,6 +40,7 @@ public void testBooleanPrimitiveArrayUnwrap() throws Exception // [databind#381] ObjectMapper mapper = jsonMapperBuilder() .enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); BooleanBean result = mapper.readValue(new StringReader("{\"v\":[true]}"), BooleanBean.class); assertTrue(result._v); diff --git a/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java b/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java index 2e0d160144..0a84ed9c63 100644 --- a/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java +++ b/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java @@ -134,12 +134,14 @@ public void testWithCreatorAndViews() throws Exception result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewA.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':1,'b':2}")); assertEquals(1, result.a); assertEquals(0, result.b); result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewB.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':1,'b':2}")); assertEquals(0, result.a); assertEquals(2, result.b); @@ -147,6 +149,7 @@ public void testWithCreatorAndViews() throws Exception // and actually... fine to skip incompatible stuff too result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewB.class) + .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':[ 1, 23, { } ],'b':2}")); assertEquals(0, result.a); assertEquals(2, result.b); From 4bb08337abc7a433ce0e52c8fad58c3ae34c9968 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 12:24:18 -0800 Subject: [PATCH 3/9] Remove extra config claused merged from "master" --- .../tools/jackson/databind/convert/CoerceStringToIntsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java b/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java index 063d71a83a..f6aece9878 100644 --- a/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java +++ b/src/test/java/tools/jackson/databind/convert/CoerceStringToIntsTest.java @@ -38,7 +38,6 @@ public class CoerceStringToIntsTest .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .withCoercionConfig(LogicalType.Integer, cfg -> cfg.setCoercion(CoercionInputShape.String, CoercionAction.AsNull)) - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); private final ObjectMapper MAPPER_TO_FAIL = jsonMapperBuilder() From 31e091a003d2591c12a6cef637d3eb83e052afd9 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 12:31:04 -0800 Subject: [PATCH 4/9] Change test fix slightly --- .../tools/jackson/databind/module/SimpleModuleTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java b/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java index ea3680561c..158e5d2786 100644 --- a/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/tools/jackson/databind/module/SimpleModuleTest.java @@ -27,9 +27,9 @@ public class SimpleModuleTest extends DatabindTestUtil final static class CustomBean { protected String str; - protected int num; + protected Integer num; - public CustomBean(String s, int i) { + public CustomBean(String s, Integer i) { str = s; num = i; } @@ -214,8 +214,6 @@ public void testWithoutModule() .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) // since 3.0 not enabled by default .enable(SerializationFeature.FAIL_ON_EMPTY_BEANS) - // since 3.0 enabled by default - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); // first: serialization failure: try { From 67b04d2ceb90e19f7c051aed060ae314322f3562 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 17:43:12 -0800 Subject: [PATCH 5/9] Remove now unnecessary config overrides --- .../tools/jackson/databind/views/ViewDeserializationTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java b/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java index 3f6cecb0a9..e39c5829b5 100644 --- a/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java +++ b/src/test/java/tools/jackson/databind/views/ViewDeserializationTest.java @@ -134,14 +134,12 @@ public void testWithCreatorAndViews() throws Exception result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewA.class) - .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':1,'b':2}")); assertEquals(1, result.a); assertEquals(null, result.b); result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewB.class) - .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':1,'b':2}")); assertEquals(null, result.a); assertEquals(2, result.b); @@ -149,7 +147,6 @@ public void testWithCreatorAndViews() throws Exception // and actually... fine to skip incompatible stuff too result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewB.class) - .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .readValue(a2q("{'a':[ 1, 23, { } ],'b':2}")); assertEquals(null, result.a); assertEquals(2, result.b); From e5d4f5cc527d86326a815ae094c615f5b8445b16 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 17:47:42 -0800 Subject: [PATCH 6/9] Remove unnecessary (now) config --- src/test/java/tools/jackson/databind/big/BiggerDataTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/tools/jackson/databind/big/BiggerDataTest.java b/src/test/java/tools/jackson/databind/big/BiggerDataTest.java index 28aa902f17..65ca5b6836 100644 --- a/src/test/java/tools/jackson/databind/big/BiggerDataTest.java +++ b/src/test/java/tools/jackson/databind/big/BiggerDataTest.java @@ -78,9 +78,7 @@ static class Area { /********************************************************** */ - private final ObjectMapper MAPPER = JsonMapper.builder() - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) - .build(); + private final ObjectMapper MAPPER = JsonMapper.builder().build(); @Test public void testReading() throws Exception From 0d44430ad36b30b16ab2c7fc87af3fdb6ca23e7d Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 18:36:51 -0800 Subject: [PATCH 7/9] Trim now-unnecessary config --- .../databind/deser/builder/BuilderInfiniteLoop1979Test.java | 6 +----- .../jackson/databind/deser/builder/BuilderWithViewTest.java | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java b/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java index ccaa6b8898..baa558e7a8 100644 --- a/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java +++ b/src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped; -import tools.jackson.databind.*; import tools.jackson.databind.annotation.JsonDeserialize; import tools.jackson.databind.testutil.DatabindTestUtil; @@ -95,10 +94,7 @@ static class SubBean public void testInfiniteLoop1978() throws Exception { String json = "{\"sub.el1\":34,\"sub.el2\":\"some text\"}"; - ObjectMapper mapper = jsonMapperBuilder() - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) - .build(); - Bean bean = mapper.readValue( json, Bean.class ); + Bean bean = sharedMapper().readValue( json, Bean.class ); assertNotNull(bean); } } diff --git a/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java b/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java index 3c88484405..7cf5d205f0 100644 --- a/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java +++ b/src/test/java/tools/jackson/databind/deser/builder/BuilderWithViewTest.java @@ -87,7 +87,6 @@ public CreatorValueXY build() { private final ObjectMapper MAPPER = jsonMapperBuilder() .disable(DeserializationFeature.FAIL_ON_UNEXPECTED_VIEW_PROPERTIES) - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .build(); @Test From 119bdcdb4c48292ac19ba01e1162dc6e9fd255fe Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 18:39:03 -0800 Subject: [PATCH 8/9] Yet more trimming --- .../jackson/databind/deser/creators/RequiredCreatorTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java b/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java index 7acd4c6a2f..97cc7b7a35 100644 --- a/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java +++ b/src/test/java/tools/jackson/databind/deser/creators/RequiredCreatorTest.java @@ -64,8 +64,7 @@ public void setUserType(String userType) { */ private final ObjectMapper MAPPER = newJsonMapper(); - private final ObjectReader POINT_READER = MAPPER.readerFor(FascistPoint.class) - .without(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); + private final ObjectReader POINT_READER = MAPPER.readerFor(FascistPoint.class); @Test public void testRequiredAnnotatedParam() throws Exception From f7c8ceb2d0a5051b6833c23a1b7e1b875dbbe992 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 8 Jan 2025 19:09:25 -0800 Subject: [PATCH 9/9] Remove unneeded config --- .../jackson/databind/struct/TestPOJOAsArrayWithBuilder.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java index 1c3c5a9f17..59d427150c 100644 --- a/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java +++ b/src/test/java/tools/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java @@ -105,9 +105,7 @@ public CreatorValue build() { /***************************************************** */ - private final static ObjectMapper MAPPER = jsonMapperBuilder() - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) - .build(); + private final static ObjectMapper MAPPER = newJsonMapper(); @Test public void testSimpleBuilder() throws Exception