Issue
I'm trying to parse "1901-01-01T00:20:40.000+02:20:40" date but I'm getting the following error:
Cannot deserialize value of type java.util.Date
from String "1901-01-01T00:20:40.000+02:20:40": not a valid representation (error: Failed to parse Date value '1901-01-01T00:20:40.000+02:20:40': Cannot parse date "1901-01-01T00:20:40.000+02:20:40":
I read it is a problem with java date format which is not able the pare old dates, is there something that I can do in order to fix this issue?
---- edit ----
until now, i deserialized lots of different dates from the last 20 years, and they all worked fine. It is a very simple object:
public class Record extends Docs {
public Date published;
}
and
results =
given().
config(config).
log().ifValidationFails().
when().
get(lastUrlComponent).
then().
log().ifValidationFails().
statusCode(HttpStatus.SC_OK).
contentType(ContentType.JSON).
assertThat().body(matchesJsonSchemaInClasspath(jsonSchemaInClasspath)).
extract().
response().as(resultsClass);
}
Solution
"1901-01-01T00:20:40.000+02:20:40" is not a valid offset - 2 hours, 20 minutes, and 40 seconds from UTC
Answered By - Noy M
Answer Checked By - Mary Flores (JavaFixing Volunteer)