Skip to content

Commit b8a22db

Browse files
committed
Update release notes wrt #3913 fix
1 parent 9f45530 commit b8a22db

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

release-notes/VERSION-2.x

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Project: jackson-databind
88

99
#3894: Only avoid Records fields detection for deserialization
1010
(contributed by Sim Y-T)
11+
#3913: Issue with deserialization when there are unexpected properties (due
12+
to null `StreamReadConstraints`)
13+
(reported by @sbertault)
1114

1215
2.15.0 (23-Apr-2023)
1316

src/test/java/com/fasterxml/jackson/databind/deser/Issue1009Test.java renamed to src/test/java/com/fasterxml/jackson/databind/deser/Issue3913DeserTest.java

+17-18
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,11 @@
99

1010
import java.util.List;
1111

12-
public class Issue1009Test extends BaseMapTest {
13-
14-
public void testDeserialization() throws JsonProcessingException {
15-
String rawResponse = "{\"list\":[{\"type\":\"impl\",\"unmappedKey\":\"unusedValue\"}]}";
16-
MyResponse myResponse = objectMapper().readValue(rawResponse, MyResponse.class);
17-
assertNotNull(myResponse);
18-
assertEquals(1, myResponse.list.size());
19-
assertEquals("impl", myResponse.list.get(0).getType());
20-
assertNull(myResponse.list.get(0).getMissingInJson());
21-
}
22-
23-
protected ObjectMapper objectMapper() {
24-
ObjectMapper om = new ObjectMapper();
25-
om.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
26-
return om;
27-
}
28-
12+
public class Issue3913DeserTest extends BaseMapTest
13+
{
14+
// [databind#3913]
2915
static class MyResponse {
30-
private List<Base> list;
16+
List<Base> list;
3117

3218
public List<Base> getList() {
3319
return list;
@@ -86,4 +72,17 @@ public void setMissingInJson(String missingInJson) {
8672
this.missingInJson = missingInJson;
8773
}
8874
}
75+
76+
// [databind#3913]
77+
public void testDeserialization() throws JsonProcessingException {
78+
ObjectMapper mapper = jsonMapperBuilder()
79+
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
80+
.build();
81+
String rawResponse = "{\"list\":[{\"type\":\"impl\",\"unmappedKey\":\"unusedValue\"}]}";
82+
MyResponse myResponse = mapper.readValue(rawResponse, MyResponse.class);
83+
assertNotNull(myResponse);
84+
assertEquals(1, myResponse.list.size());
85+
assertEquals("impl", myResponse.list.get(0).getType());
86+
assertNull(myResponse.list.get(0).getMissingInJson());
87+
}
8988
}

0 commit comments

Comments
 (0)