Open
Description
@JacksonXmlElementWrapper(useWrapping = false)
results in an exception being thrown when used inside a @JsonUnwrapped
property:
java.lang.IllegalStateException: Internal error: should never get called
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.newDelegatingInstance(WrapperHandlingDeserializer.java:64)
A small reproducer of what I'm trying to achieve is described below. Note that my example does not make sense in any real application without the context of my actual application, but it's a clear minimal example to show what is happening.
XML I'm deserializing:
<pojo>
<value>a</value>
<value>b</value>
</pojo>
Classes I'm deserializing to:
public class Pojo {
private Nested nested;
@JsonUnwrapped
public Nested getNested() {
return nested;
}
public void setNested(Nested nested) {
this.nested = nested;
}
}
public class Nested {
private List<String> values;
@JacksonXmlElementWrapper(useWrapping = false)
@JacksonXmlProperty(localName = "value")
public List<String> getValues() {
return values;
}
public void setValues(List<String> values) {
this.values = values;
}
}
The following code then throws the aformentioned exception:
XmlMapper mapper = new XmlMapper();
Pojo actual = mapper.readValue(xml, Pojo.class);
Related: #676
The order of "unwrapping" here is the other way around.
Metadata
Metadata
Assignees
Labels
No labels