Skip to content

Commit

Permalink
Minor tweak wrt #94
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 22, 2020
1 parent ca79027 commit 26827c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ protected LocalDateTime _fromString(JsonParser p, DeserializationContext ctxt,
if (string.length() > 10 && string.charAt(10) == 'T') {
if (string.endsWith("Z")) {
JavaType t = getValueType(ctxt);
ctxt.reportInputMismatch(t,
return (LocalDateTime) ctxt.handleWeirdStringValue(t.getRawClass(),
string,
"Invalid value ('%s') for %s: should not contain timezone/offset (define custom `@JsonFormat(pattern=)` if you must accept)",
string, ClassUtil.getTypeDescription(t));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ public void testBadDeserializationOfTimeWithTimeZone() throws Exception
MAPPER.readValue(quote("2020-10-22T00:16:20.504Z"), LocalDateTime.class);
fail("expected fail");
} catch (InvalidFormatException e) {
verifyException(e, "Cannot deserialize value of type");
verifyException(e, "from String \"");
verifyException(e, "Invalid value");
verifyException(e, "for `java.time.LocalDateTime`");
}
}

Expand Down

0 comments on commit 26827c5

Please sign in to comment.