File tree 2 files changed +15
-1
lines changed
src/main/java/com/fasterxml/jackson/dataformat/xml
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ public Builder(XmlFactory f) {
76
76
77
77
// 04-May-2018, tatu: Important! Let's also default `String` `null` handling to coerce
78
78
// to empty string -- this lets us induce `null` from empty tags first
79
+
80
+ // 08-Sep-2019, tatu: Note: this could conflict with [dataformat-xml#354] (true `null`s
81
+ // with `xsi:nil`) unless we are careful to distinguish empty/null
79
82
_configOverrides .findOrCreateOverride (String .class )
80
83
.setNullHandling (JsonSetter .Value .forValueNulls (Nulls .AS_EMPTY ));
81
84
}
Original file line number Diff line number Diff line change 6
6
import com .fasterxml .jackson .databind .*;
7
7
import com .fasterxml .jackson .databind .deser .std .StdScalarDeserializer ;
8
8
import com .fasterxml .jackson .databind .jsontype .TypeDeserializer ;
9
+ import com .fasterxml .jackson .databind .util .AccessPattern ;
9
10
10
11
/**
11
12
* Custom variant used instead of "plain" {@code StringDeserializer} to handle
@@ -22,10 +23,20 @@ public class XmlStringDeserializer
22
23
public boolean isCachable () { return true ; }
23
24
24
25
@ Override
25
- public Object getEmptyValue (DeserializationContext ctxt ) throws JsonMappingException {
26
+ public Object getEmptyValue (DeserializationContext ctxt ) {
26
27
return "" ;
27
28
}
28
29
30
+ @ Override
31
+ public Object getNullValue (DeserializationContext ctxt ) {
32
+ return null ;
33
+ }
34
+
35
+ @ Override
36
+ public AccessPattern getEmptyAccessPattern () {
37
+ return AccessPattern .CONSTANT ;
38
+ }
39
+
29
40
@ Override
30
41
public String deserialize (JsonParser p , DeserializationContext ctxt ) throws IOException
31
42
{
You can’t perform that action at this time.
0 commit comments