-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Parsing empty tags without default no-arguments constructor fails in 2.14 #547
Comments
@henrik242 Since we cannot use Kotlin in tests here (not allowed to add dependency), would it be possible to have Java version? It also rules out possibility the issue with Kotlin module, which is quite often the case. |
I'm not sure if I'm able to reproduce it with plain java. Maybe move this issue to jackson-kotlin-module and rename Github396.kt to match? Or reopen issue 396 there? |
It has to be in Kotlin if it uses Kotlin code. Or to avoid Kotlin module (test) dependency to XML, could also go into Looking at stack trace this does seem to call the wrong constructor via |
Oh. Or this might occur with Java too. The problem, I think, is that there is ambiguity on empty String value being found. There are 2 ways to consider it:
so perhaps this would occur with similar POJO. But I think Jackson 2.13 added "coerce Scalar from Object [in some cases]" which might solve this... unless it only works for not-all-white-space case (seems plausible). |
Yeah, it can easily go there too since it also has a failing test that cover this (as mentioned above).
But in this case there's no white space at all, just no definition of the arg in the default constructor. |
Ah. Yes, indeed. |
I'm getting a couple of test regressions going from 2.11.3 to 2.14.0 writing scala which I think are related to this. One failing test I have seems to be a carbon copy of @henrik242's posted situation.
On another test an empty tag returns |
At this point what I would really need is a plain Java test. I'd love to have a look but I'd need to translate Data classes into their equivalent (from JVM perspective) counterparts. The specific distinction has to do with EXACTLY how constructor for I am guessing tho that |
@henrik242 Ok, I think that what you can do is to add I will try to see if the alternative (Inner declared to take EDIT: there is actually another work-around that does work with |
Fixed in 2.15 branch (for 2.15.0) -- actual fix is in |
@cowtowncoder Thanks! Is it a bit too early to ask for an 2.15 release date estimate? 😄 |
Yes it is. :) It will take a while, most likely, looking at historic trends. |
@cowtowncoder Okay, I kinda assumed as much :) We have a lot of data classes affected by this, so a per-class workaround will require a lot of work. There aren't any workarounds that can be put on the ObjectMapper, right? |
I can't think of any based on specific fix, but that does not mean someone could not figure out a way around it. However... I suspect that you could use |
As in #491, I've found an additional issue where parsing empty tags without default constructor fails. This worked in 2.11.3, but has failed since.
Check should_parse_empty_tag_without_default_constructor() in https://github.com/henrik242/jackson-xml-problem/blob/no-string-argument/src/test/java/jackson/xml/NoStringArgumentTest.java#L37
Test (java):
Code (kotlin):
Fails with:
This is the exact same issue as mentioned in FasterXML/jackson-module-kotlin#396, and is already covered a couple of places with existing failing tests:
The text was updated successfully, but these errors were encountered: