Skip to content

Commit f199076

Browse files
committed
Update release notes wrt #445, move test from failing to non-failing
1 parent 51889d0 commit f199076

File tree

4 files changed

+34
-39
lines changed

4 files changed

+34
-39
lines changed

release-notes/CREDITS-2.x

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ Migwel@github
120120
* Contributed #360: Add a feature to support writing `xsi:nil` attribute for
121121
`null` values
122122
(2.12.0)
123-
123+
* Contributed fix for #445: `XmlMapper`/`UntypedObjectDeserializer` mixes
124+
multiple unwrapped collections
125+
(2.12.2)
126+
124127
Ingo Wiarda (dewarim@github)
125128

126129
* Reported #374: Deserialization fails with `XmlMapper` and

release-notes/VERSION-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-dataformat-xml
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.12.2 (not yet released)
8+
9+
#445: `XmlMapper`/`UntypedObjectDeserializer` mixes multiple unwrapped collections
10+
(fix contributed by Migwel@github)
11+
712
2.12.1 (08-Jan-2021)
813

914
#435: After upgrade to 2.12.0, NPE when deserializing an empty element to `ArrayList`

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/UntypedObjectDeserTest.java

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.fasterxml.jackson.dataformat.xml.deser;
22

3+
import java.util.Arrays;
4+
import java.util.List;
5+
import java.util.Map;
6+
37
import com.fasterxml.jackson.databind.JsonNode;
48
import com.fasterxml.jackson.databind.ObjectMapper;
59
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -81,4 +85,25 @@ public void testMixedContent() throws Exception
8185
fail("Expected:\n"+w.writeValueAsString(exp)+"\ngot:\n"+w.writeValueAsString(fromXml));
8286
}
8387
}
88+
89+
// [dataformat-xml#445]: problem with earlier #205 implementation (from 2.12.0),
90+
// fixed in 2.12.2
91+
public void testDuplicateListDeser445() throws Exception
92+
{
93+
final String XML =
94+
"<person>\n" +
95+
" <name>a</name>\n" +
96+
" <name>b</name>\n" +
97+
" <surname>c</surname>\n" +
98+
" <surname>d</surname>\n" +
99+
"</person>";
100+
@SuppressWarnings("unchecked")
101+
Map<String, List<String>> person = (Map<String, List<String>>) XML_MAPPER.readValue(XML, Object.class);
102+
List<String> names = person.get("name");
103+
List<String> surnames = person.get("surname");
104+
assertEquals(2, names.size());
105+
assertEquals(Arrays.asList("a", "b"), names);
106+
assertEquals(2, surnames.size());
107+
assertEquals(Arrays.asList("c", "d"), surnames);
108+
}
84109
}

src/test/java/com/fasterxml/jackson/dataformat/xml/failing/UntypedObjectDeserializer445Test.java

-38
This file was deleted.

0 commit comments

Comments
 (0)