- 
                Notifications
    
You must be signed in to change notification settings  - Fork 540
 
Open
Labels
bugSomething isn't workingSomething isn't working
Description
问题描述
公元前时间反序列化出错
环境信息
请填写以下信息:
- OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
 - JDK信息: [e.g.:Openjdk 1.8.0_312]
 - 版本信息:[e.g.:Fastjson2 2.0.60]
 
重现步骤
    LocalDateTime time=LocalDateTime.of(0,1,1,0,0,0,0).minusHours(8);
    JSONObject bean=new JSONObject().fluentPut("time",time);
    String s = bean.toJSONString();
    System.out.println(s);
    System.out.println(JSON.parseObject(s).getLocalDateTime("time"));
期待的正确结果
不抛出异常
相关日志输出
Exception in thread "main" com.alibaba.fastjson2.JSONException: read LocalDateTime error -0001-12-31 16:00:00, offset 22, character �, line 1, column 22, fastjson-version 2.0.60 "-0001-12-31 16:00:00"
at com.alibaba.fastjson2.JSONReader.readLocalDateTime(JSONReader.java:2506)
at com.alibaba.fastjson2.reader.ObjectReaderImplLocalDateTime.readObject(ObjectReaderImplLocalDateTime.java:64)
at com.alibaba.fastjson2.util.TypeUtils.cast(TypeUtils.java:1522)
at com.alibaba.fastjson2.util.TypeUtils.cast(TypeUtils.java:1426)
at com.alibaba.fastjson2.JSONObject.getLocalDateTime(JSONObject.java:1087)
at com.alibaba.fastjson2.JSONObject.getLocalDateTime(JSONObject.java:1072)
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working