-
-
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
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
not honored in xml module for attributes
#25
Comments
Hmmh. I don't quite follow: in XML is equivalent to ; there is no semantic difference. So what is the problem, and how would you expect things to work instead? |
Hi I'm sorry I dont have access to my test project right now. But if I remember correctly, the issue was that, given the code: class A {
@JacksonXmlProperty( isAttribute = true )
private String stringA = ""
private String stringB = ""
} This would give in XML (which I agree is correct): <A stringA="">
<stringB />
</A> But, when deserialized, it would give me: class A {
@JacksonXmlProperty( isAttribute = true )
private String stringA = ""
private String stringB = null;
} Hope this makes it a bit more clear. If you need more information, I will try and find my little test project for this. |
Ah! Yes, this explains it better. Thank you -- unit tests are always appreciated, but I think I now understand the issue and can work on it. |
Hmmh. ACCEPT_EMPTY_STRING_AS_NULL_OBJECT only states that empty String is a valid representation as null of any Object type, so behavior is not exactly incorrect. |
Since this is an old issue I am not sure if it can be reproduced as is. There are newer related issues as well, so I will close this one in favor of newer ones. |
Can you reference "newer related issues"? This problem is still present for 2.9.5. |
Turns out there was a unit test I had added earlier. Was able to fix but only for 3.0.0, unfortunately, not 2.9. |
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
not honored in xml module for attributes
I'm having some issues with the treatment of empty strings in the XML module.
Say I have this:
In JSON this would give me:
In XML this gives me:
Which means that the attribute is treated correctly (as according to
the defaults), but for the element, it shows up as null. And is
therefore deserialized back as a null string.
The text was updated successfully, but these errors were encountered: