File tree 1 file changed +12
-2
lines changed
src/test/java/com/fasterxml/jackson/dataformat/xml/failing
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 4
4
import java .util .List ;
5
5
6
6
import com .fasterxml .jackson .annotation .JsonProperty ;
7
+ import com .fasterxml .jackson .annotation .JsonSetter ;
8
+ import com .fasterxml .jackson .annotation .Nulls ;
7
9
import com .fasterxml .jackson .dataformat .xml .*;
8
10
9
11
// for [dataformat-xml#124]
@@ -16,11 +18,19 @@ public static class TestList {
16
18
17
19
// [dataformat-xml#124]
18
20
public void test124 () throws Exception {
19
- final XmlMapper xmlMapper = new XmlMapper ();
21
+ final XmlMapper xmlMapper = XmlMapper .builder ()
22
+ .build ();
23
+
24
+ // 14-Jan-2020, tatu: This is actual working override to resolve the issue...
25
+ // Not sure if this can be otherwise resolved.
26
+
27
+ // xmlMapper.configOverride(List.class)
28
+ // .setSetterInfo(JsonSetter.Value.forValueNulls(Nulls.AS_EMPTY));
29
+
20
30
TestList originalObject = new TestList ();
21
31
originalObject .list = new ArrayList <Object >();
22
32
String xml = xmlMapper .writeValueAsString (originalObject );
23
- //System.err.println(xml); // print <TestList><list/>></TestList>
33
+ //System.err.println(xml); // prints <TestList><list/>></TestList>
24
34
25
35
TestList result = xmlMapper .readValue (xml , TestList .class );
26
36
You can’t perform that action at this time.
0 commit comments