-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@JsonSetter(nulls=...)
not working with XML
#285
Comments
The following seems to work as expected class Real
class ScalarVariable {
@JsonSetter(nulls = Nulls.AS_EMPTY)
@JacksonXmlProperty(localName = "Real")
var real: Real? = null
}
@Test
fun test() {
val xml = """
<ScalarVariable >
<Real />
</ScalarVariable >
"""
val mapper = XmlMapper().apply {
registerModule(KotlinModule())
}
val variable = mapper.readValue<ScalarVariable>(xml)
Assert.assertNotNull(variable.real)
} Removing @JsonSetter(nulls = Nulls.AS_EMPTY) And the test will fail Version 2.9.5 |
@markaren thank you for testing it. I actually noticed the same: I have a more elaborate case that uses generic type, and that is problematic for some reason... but simple POJO dependency does work. |
Actually, looks like it IS working, but... As per #246, only empty tag (like There may be 2 follow up things here:
|
Will work better in 2.9.6 as well. |
Hi, is this planned for a future milestone?
|
@PaulBenn You may try this against |
(note: follow-up from #209)
Ok it looks like feature added in 2.9 for configurable null handling:
FasterXML/jackson-databind#1402
does not quite work with XML. Need to figure out why, and fix it.
The text was updated successfully, but these errors were encountered: