Closed
Description
Running version 2.11.4
using the following configuration:
// Create new mapper
final JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
final XmlMapper mapper = new XmlMapper(module);
// Configure it
mapper
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
.registerModule(new JodaModule())
.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
Parsing the following xml:
<campaign>
<id>123</id>
<name>Website Tracking</name>
<cost/>
</campaign>
into the following bean:
public class Campaign {
private Long id;
private String name;
private Integer cost;
public Long getId() {
return id;
}
public String getName() {
return name;
}
public Integer getCost() {
return cost;
}
public void setId(final Long id) {
this.id = id;
}
public void setName(final String name) {
this.name = name;
}
public void setCost(final Integer cost) {
this.cost = cost;
}
}
usage:
// mapper instance as defined above, campaignXmlStr as defined above.
mapper.readValue(campaignXmlStr, Campaign.class);
The above JSON gets deserialized into the bean with the cost
property being set to null
.
With version 2.12.x
the cost
property becomes integer 0
I reviewed the release notes and didn't notice any breaking change listed in behavior. Is this change expected?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels