Open cristibozga opened 1 year ago
Had the same issue and fixed it by updating the pattern to "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
, but did not dig into why "yyyy-MM-dd'T'HH:mm:ss'Z'"
doesn't work when OffsetDateTime.parse()
is fine with a string in the yyyy-MM-dd'T'HH:mm:ss'Z'
format.
I faced error similar to what is posted above, when I upgraded lombok from '1.18.12' to '1.18.30'. In my project, Tests which were working fine earlier started failing with deserialization error after the lombok version upgrade. Error fixed itself when I downgraded back the lombok version.
So, I think this has something to do with one of the transitive dependencies not being compatible.
Jdk 8 Azul Zulu Jackson2:2.10.1 library version jackson-annotations component
Including JDK version for failing case would be useful as well. And obviously Jackson versions (plus need to ensure Jackson versions of components are aligned).
Lombok version discrepancy sounds odd, but could be due to Lombok's changing Jackson annotations it adds.
Including JDK version for failing case would be useful as well. And obviously Jackson versions (plus need to ensure Jackson versions of components are aligned).
Lombok version discrepancy sounds odd, but could be due to Lombok's changing Jackson annotations it adds.
Added details in my original comment. What I could not understand is that before and after Lombok upgrade, Jackson2 library version was same.
@jaymanik Jackson 2.10 is very old version, as the latest is 2.17.2. So I would try out version upgrade first.
But I also realized that the original issue did not refer to Lombok so not sure if @jaymanik 's problem is same as @cristibozga's.
@jaymanik Jackson 2.10 is very old version, as the latest is 2.17.2. So I would try out version upgrade first.
But I also realized that the original issue did not refer to Lombok so not sure if @jaymanik 's problem is same as @cristibozga's.
Thank you for your suggestion. I will try to upgrade jackson2 and give it a try.
Apologies for not sharing stack trace. We are not allowed to add GitHub comments from my work machine.
Sorry for missing some important data. So: Jackson version is 2.13.5 JDK version is 17
Including JDK version for failing case would be useful as well. And obviously Jackson versions (plus need to ensure Jackson versions of components are aligned).
Lombok version discrepancy sounds odd, but could be due to Lombok's changing Jackson annotations it adds.
Jackson 2.13 is still old enough version that it'd definitely make sense to try with 2.17(.2) just rule out possibility of a fix.
Ok; verified the issue exists in 2.18 branch; added failing test as well -- don't have time to look deeper but hopefully this helps whoever decides to work on it.
If we have an OffsetDateTime property inside a DTO where we specify the pattern, the deserialization operation fails: Ex: Inside OffsetDateDto:
The code of the application:
When we write the value (serialize dto I get displayed: '{"date":"2023-09-01T11:07:48Z",...'} But the last line throws an error because deserialization fails:
I've tried also with the pattern 'yyyy-MM-dd'T'HH:mm:ssX' and I get the same error. Am I doing something wrong here?
Thanks in advance