java-time: java.time on Jackson 3 vs 2, @JsonFormat, time zones, Spring Boot 4.2 spring.jackson.*

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
2026-12-03 23:41:03 +05:30
co-authored by Claude Sonnet 5.5
parent f5ed5d1605
commit 26f64bc184
42 changed files with 1505 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
== 30 February
no pattern : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDate` from String "2026-02-30": Failed to deserialize `java.time.LocalDate` (with format 'Value(Year,4,10,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)'): (java.time.format.DateTimeParseException) Text '2026-02-30' could not be parsed: Invalid date 'FEBRUARY 30'
pattern : Default[day=2026-02-28]
lenient=FALSE, yyyy : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDate` from String "2026-02-30": Failed to deserialize `java.time.LocalDate` (with format 'Value(YearOfEra,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)'): (java.time.format.DateTimeParseException) Text '2026-02-30' could not be parsed: Unable to obtain LocalDate from TemporalAccessor: {MonthOfYear=2, DayOfMonth=30, YearOfEra=2026},ISO of type java.time.format.Parsed
lenient=FALSE, yyyy ok : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDate` from String "2026-02-28": Failed to deserialize `java.time.LocalDate` (with format 'Value(YearOfEra,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)'): (java.time.format.DateTimeParseException) Text '2026-02-28' could not be parsed: Unable to obtain LocalDate from TemporalAccessor: {MonthOfYear=2, DayOfMonth=28, YearOfEra=2026},ISO of type java.time.format.Parsed
lenient=FALSE, uuuu : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDate` from String "2026-02-30": Failed to deserialize `java.time.LocalDate` (with format 'Value(Year,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)'): (java.time.format.DateTimeParseException) Text '2026-02-30' could not be parsed: Invalid date 'FEBRUARY 30'
lenient=FALSE, uuuu ok : StrictU[day=2026-02-28]
== YYYY is the week-based year, yyyy is the calendar year
value 2026-12-29, YYYY : {"day":"2027-12-29"}
value 2026-12-29, yyyy : {"day":"2026-12-29"}
YYYY read : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDate` from String "2026-12-29": Failed to deserialize `java.time.LocalDate` (with format 'Localized(WeekBasedYear,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)'): (java.time.format.DateTimeParseException) Text '2026-12-29' could not be parsed: Unable to obtain LocalDate from TemporalAccessor: {WeekBasedYear[WeekFields[SUNDAY,1]]=2026, MonthOfYear=12, DayOfMonth=29},ISO of type java.time.format.Parsed
== A quoted 'Z' is just a letter
10:30 India wall clock : {"at":"2026-12-15T10:30:00Z"}
== A pattern on a type that has no calendar fields
Instant, no timezone : DatabindException: Unsupported field: YearOfEra
ZonedDateTime : {"at":"2026-12-15 10:30"}
Instant, no timezone : InvalidFormatException: Cannot deserialize value of type `java.time.Instant` from String "2026-12-15 05:00": Failed to deserialize `java.time.Instant` (with format 'Value(YearOfEra,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)' 'Value(HourOfDay,2)':'Value(MinuteOfHour,2)'): (java.time.DateTimeException) Unable to obtain Instant from TemporalAccessor: {},ISO resolved to 2026-12-15T05:00 of type java.time.format.Parsed
ZonedDateTime : InvalidFormatException: Cannot deserialize value of type `java.time.ZonedDateTime` from String "2026-12-15 10:30": Failed to deserialize `java.time.ZonedDateTime` (with format 'Value(YearOfEra,4,19,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2)' 'Value(HourOfDay,2)':'Value(MinuteOfHour,2)'): (java.time.DateTimeException) Unable to obtain ZonedDateTime from TemporalAccessor: {},ISO resolved to 2026-12-15T10:30 of type java.time.format.Parsed
== Strings that carry more, or less, than the target type
LocalDateTime <- ...Z : 2026-12-15T05:00
LocalDateTime <- +05:30 : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2026-12-15T10:30:00+05:30": Failed to deserialize `java.time.LocalDateTime` (with format 'ParseCaseSensitive(false)(Value(Year,4,10,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2))'T'(Value(HourOfDay,2)':'Value(MinuteOfHour,2)[':'Value(SecondOfMinute,2)[Fraction(NanoOfSecond,0,9,DecimalPoint)]])'): (java.time.format.DateTimeParseException) Text '2026-12-15T10:30:00+05:30' could not be parsed, unparsed text found at index 19
LocalDate <- date-time : 2026-12-15
LocalDate <- ...Z : 2026-12-15
Instant <- no offset : InvalidFormatException: Cannot deserialize value of type `java.time.Instant` from String "2026-12-15T10:30:00": Failed to deserialize `java.time.Instant` (with format 'ParseCaseSensitive(false)Instant()'): (java.time.format.DateTimeParseException) Text '2026-12-15T10:30:00' could not be parsed at index 19
LocalDateTime <- space : InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2026-12-15 10:30:00": Failed to deserialize `java.time.LocalDateTime` (with format 'ParseCaseSensitive(false)(Value(Year,4,10,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2))'T'(Value(HourOfDay,2)':'Value(MinuteOfHour,2)[':'Value(SecondOfMinute,2)[Fraction(NanoOfSecond,0,9,DecimalPoint)]])'): (java.time.format.DateTimeParseException) Text '2026-12-15 10:30:00' could not be parsed at index 10
LocalDate <- "" : null