We are facing some weird behavior with date serializations with Jackson. It is happening very rarely.
In one example, we send a POST request with a serialized date in format:
public static String createUTCdateString() {
//Time in GMT
SimpleDateFormat simpleDateFormatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
simpleDateFormatUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormatUTC.format(new Date());
}
We made 2 posts with 2ms difference, in the logs I see the dates are serialized as :
"2019-02-25T08:02:47.950Z"
"2019-02-25T08:02:47.952Z"
on reception, the date is deserialized to DTO with the wrong date. 2nd event has a date 4701 instead of 2019.
date=Mon Feb 25 08:02:47 UTC 2019,
date=Mon Feb 25 08:02:47 UTC 4701,
The field in the DTO is as follows:
@NotNull
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private Date date;
Why would this happen?
Weirdly, I could not find anything related to this. Any help is appreciated.
EDIT:
The serializing component is of Vertx 3.5.1
using Jackson 2.9.3
apparently.
https://github.com/vert-x3/wiki/wiki/3.5.1-Release-Notes
The deserializing component is of Spring Boot using Jackson 2.8.x