we had this weird bug that when we read data out of MySQL database and deserialize it to POJO,
Cannot parse \"2014-02-29T00:00:00+0000\": Value 29 for dayOfMonth must be in the range [1,28] (through reference chain: com.reports.common.SearchResult[\"entities\"]->java.util.HashSet[19]->com.reports.common.User[\"registrationDate\"])"}
as we checked the records in database, there is no records show registrationDate as '2014-02-29', the closest thing is '2014-02-19'. we use multi-threads to read data out of Mysql table, I'm wondering if it's because the Joda's dateTime deserializer is thread unsafe?
and here is our POJO:
public class SearchResult {
@JsonProperty("entities")
Set<User> users = new HashSet<>();
String totalRecords;
}
public class User {
private String email;
private String gui;
private DateTime creationDate;
private DateTime registrationDate;
}
and here is our ObjectMapper:
public class PyObjectMapper extends ObjectMapper {
public PyObjectMapper() {
registerModule(new JodaModule());
}
}
in our code we use multi-threads to call client code who read from database and map the result to POJO
result = client.getResourceLocator().getMembers(orgId, query,returnFields, bookmark, limit);
if (result != null) {
try {
searchResult = mapper.readValue(result.toString(), SearchResult.class);
} catch (Exception e) {
throw e;
}
the joda we used in pom are:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.6.6</version>
</dependency>