You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't deserialize xsi:nil in collections. I use jackson 2.9.8
Sample test to reproduce it:
`class NilTest {
@Test
void shouldDeserialize() throws IOException {
String xml = "" +
"<A>" +
" <c xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>" + // no problems with this one
" <e>ee</e>" +
" <B>" +
" <d>dd</d>" +
" </B>" +
" <B>" +
" <d xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/>" + // fails in collections
" <f>ff</f>" +
" </B>" +
"</A>";
XmlMapper mapper = new XmlMapper();
A result = mapper.readValue(xml, A.class);
assertNotNull(result);
}
@Setter
static class A {
private String c;
private String e;
@JsonProperty("B")
@JacksonXmlElementWrapper(useWrapping = false)
private List<B> bs;
}
@Setter
static class B {
private String d;
private String f;
}
}`
Exception:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of NilTest$B (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('ff')
at [Source: (StringReader); line: 1, column: 205] (through reference chain: NilTest$A["B"]->java.util.ArrayList[2])
The text was updated successfully, but these errors were encountered:
I think this is due to there being no special handling for nsi:nil -- XML specification does not put any special meaning to it (XML Schema specification does).
So to support this, XML format module would need to explicitly understand concept.
It would have to be determined from attribute value to essentially generate JsonToken.VALUE_NULL, instead of whatever contents there might be (ideally I assume element should not contain anything).
I think the first open issue that covers this, then, is #89. There isn't anything special about List/collection values.
I can't deserialize xsi:nil in collections. I use jackson 2.9.8
Sample test to reproduce it:
`class NilTest {
}`
Exception:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of
NilTest$B
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('ff')at [Source: (StringReader); line: 1, column: 205] (through reference chain: NilTest$A["B"]->java.util.ArrayList[2])
The text was updated successfully, but these errors were encountered: