-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Option Deserialization issue with param names that have dashes #438
Comments
I added a test case (ParamWithDashNameDeserializerTest) to the 2.10 branch and the issue appears to be that when deserialising, Jackson includes an Integer in the Option instead of a Long - and this leads to an unboxing error when you try to use the Option instance.
|
That might have to do with the Java variables naming, you can't have dashes in Java variables. |
This appears to work ok in v2.12 - so closing |
there was a remaining issue when Scala 2.11 was used - I have a fix for this in Jackson-Module-Scala 2.12.2 |
Hi,
I am using "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.10.0"
I am using a deserializer to read json message post into kafka.
At a time we faced a java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long.
I dig into this issue and found the related issues in github and the FAQ https://github.com/FasterXML/jackson-module-scala/wiki/FAQ that indicate to annotate offending field with @JsonDeserialize.
I tried this with no success.
My case class look like this (adapt like the one in the test case https://github.com/FasterXML/jackson-module-scala/blob/master/src/test/scala/com/fasterxml/jackson/module/scala/deser/PrimitiveContainerTest.scala)
I try to understand why the test in scala module works but not our code and found that this is because the property contain a dash and we kept the dash in the scala props (Disgusting!).
I finally try to add @JsonProperty annotation to remove the dash and it's working.
I am not sure this issue is related to jackson deserialization and can be fix or it's scala/java that do something when a property have a dash in it.
At least it can help to add a note about this in the workarounds of the FAQ.
Here some tests case to reproduce the issue.
Initial question from google groups https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/jackson-user/NKSx88srl-g/X4Ea2PgfAwAJ
The text was updated successfully, but these errors were encountered: