You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DateTime.parse() is replaced by using the JacksonJodaDateFormat, which defaults to FormatConfig.DEFAULT_DATETIME_FORMAT, which is defined as new JacksonJodaDateFormat(ISODateTimeFormat.dateTime().withZoneUTC()).
As an example, the datetime "2015-07-27T08:11:07-07:00" is missing the .SSS milliseconds value, so it fails in 2.6.0 but works in 2.5.4:
Caused by: java.lang.IllegalArgumentException: Invalid format: "2015-07-27T08:11:07-07:00" is malformed at "-07:00"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899) ~[joda-time-2.8.1.jar:2.8.1]
at com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer.deserialize(DateTimeDeserializer.java:90) ~[jackson-datatype-joda-2.6.0.jar:2.6.0]
at com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer.deserialize(DateTimeDeserializer.java:22) ~[jackson-datatype-joda-2.6.0.jar:2.6.0]
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520) ~[jackson-databind-2.6.0.jar:2.6.0]
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101) ~[jackson-databind-2.6.0.jar:2.6.0]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256) ~[jackson-databind-2.6.0.jar:2.6.0]
A workaround in this situation is to add a @JsonFormat annotation to the property specifying the specific format, e.g: @JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZZ")
The text was updated successfully, but these errors were encountered:
Ugh. I am surprised to find that said underlying change actually changes behavior, so change was definitely not intentional. I thought I had looked briefly at patterns to make sure they fit with expected ones, but I think I was assuming that if names (of constants) matched, underlying patterns would too.
In this commit, for DateTimeSerializer:
cf2f4c2#diff-86756f80e06fe3b0a847c963534b14baR55
DateTime.parse()
is replaced by using theJacksonJodaDateFormat
, which defaults toFormatConfig.DEFAULT_DATETIME_FORMAT
, which is defined asnew JacksonJodaDateFormat(ISODateTimeFormat.dateTime().withZoneUTC())
.DateTime.parse()
usesISODateTimeFormat.dateTimeParser().withOffsetParsed()
:http://www.joda.org/joda-time/apidocs/org/joda/time/DateTime.html#parse-java.lang.String-
So ultimately, the default date time parser format has changed from
ISODateTimeFormat.dateTimeParser()
toISODateTimeFormat.dateTime()
. Although similar,ISODateTimeFormat.dateTimeParser()
is much less restrictive:http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTimeParser--
As an example, the datetime "2015-07-27T08:11:07-07:00" is missing the
.SSS
milliseconds value, so it fails in 2.6.0 but works in 2.5.4:A workaround in this situation is to add a
@JsonFormat
annotation to the property specifying the specific format, e.g:@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZZ")
The text was updated successfully, but these errors were encountered: