Skip to content

Commit df37bb9

Browse files
committed
Merge branch '2.10' into 2.11
2 parents 43d8393 + f45aefc commit df37bb9

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

release-notes/CREDITS-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ Rohit Narayanan (rohitnarayanan@github)
5555

5656
* Reported #351: XmlBeanSerializer serializes AnyGetters field even with FilterExceptFilter
5757
(2.10.0)
58+
59+
Luke Korth ([email protected])
60+
61+
* Reported #366: XML containing xsi:nil is improperly parsed
62+
(2.10.2)

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Project: jackson-dataformat-xml
1010

1111
2.10.2 (not yet released)
1212

13+
#366: XML containing xsi:nil is improperly parsed
14+
(reported by Luke K)
1315
#378: Jackson 2.10.x fails to deserialize xsi:nil with multiple child elements
1416
(reported by henrik242@github)
1517

src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XsiNil378Test.java renamed to src/test/java/com/fasterxml/jackson/dataformat/xml/deser/XsiNilForStringsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
44
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
55

6-
public class XsiNil378Test extends XmlTestBase
6+
public class XsiNilForStringsTest extends XmlTestBase
77
{
88
private final static String XSI_NS_DECL = "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'";
99

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

33
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
44
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
55

6-
public class XsiNil366Test extends XmlTestBase
6+
public class XsiNilNestingTest extends XmlTestBase
77
{
88
// for [dataformat-xml#366]
99
protected static class Parent366 {
@@ -12,7 +12,6 @@ protected static class Parent366 {
1212

1313
protected static class Level1 {
1414
public Level2 level2;
15-
public String field; // this should not be needed, but an unknown element is thrown without it
1615
}
1716

1817
protected static class Level2 {
@@ -26,21 +25,25 @@ protected static class Level2 {
2625
public void testDoesNotAffectHierarchy() throws Exception
2726
{
2827
String xml = "<Parent xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
29-
+ "<level1>"
30-
+ "<level2>"
31-
+ "<ignored xsi:nil=\"true\"/>"
32-
+ "<field>test-value</field>"
33-
+ "</level2>"
34-
+ "</level1>"
28+
+ " <level1>"
29+
+ " <level2>"
30+
+ " <ignored xsi:nil=\"true\"/>"
31+
+ " <field>test-value</field>"
32+
+ " </level2>"
33+
+ " </level1>"
3534
+ "</Parent>";
3635
Parent366 bean = MAPPER.readValue(xml, Parent366.class);
3736

3837
assertNotNull(bean);
38+
assertNotNull(bean.level1);
39+
Level2 l2 = bean.level1.level2;
40+
assertNotNull(l2);
3941

40-
// this should not be set, but having an xsi:nil field before it causes it to set the next field on the wrong class
41-
assertEquals("test-value", bean.level1.field);
42+
// should be null
43+
assertNull(l2.ignored);
44+
// and should not be null
45+
assertNotNull(l2.field);
4246

43-
// fails because field is set on level1 instead of on level2
44-
assertEquals("test-value", bean.level1.level2.field);
47+
assertEquals("test-value", l2.field);
4548
}
4649
}

0 commit comments

Comments
 (0)