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
异常堆栈:
Exception in thread "main" java.time.format.DateTimeParseException: Text '2024-12-04T20:43:15.000000999' could not be parsed, unparsed text found at index 19
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2111)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:2010)
at java.base/java.time.LocalDateTime.parse(LocalDateTime.java:494)
at com.alibaba.fastjson2.reader.ObjectReaderImplDate.readDate(ObjectReaderImplDate.java:148)
at com.alibaba.fastjson2.reader.ObjectReaderImplDate.readObject(ObjectReaderImplDate.java:48)
at com.alibaba.fastjson2.reader.ORG_1_1_TestBean.readObject(Unknown Source)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:542)
The text was updated successfully, but these errors were encountered:
问题描述
原因是升级JDK21之后,LocalDateTime默认精度从毫秒升级到纳秒了。
重现代码如下:
异常堆栈:
Exception in thread "main" java.time.format.DateTimeParseException: Text '2024-12-04T20:43:15.000000999' could not be parsed, unparsed text found at index 19
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2111)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:2010)
at java.base/java.time.LocalDateTime.parse(LocalDateTime.java:494)
at com.alibaba.fastjson2.reader.ObjectReaderImplDate.readDate(ObjectReaderImplDate.java:148)
at com.alibaba.fastjson2.reader.ObjectReaderImplDate.readObject(ObjectReaderImplDate.java:48)
at com.alibaba.fastjson2.reader.ORG_1_1_TestBean.readObject(Unknown Source)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:542)
The text was updated successfully, but these errors were encountered: