Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 兼容版本2.0.9 JSON.parseObject 转换实体 时间格式空串会默认 1970-01-01 08:00:00属性值 #550

Closed
afish177 opened this issue Jul 12, 2022 · 7 comments
Labels
bug Something isn't working
Milestone

Comments

@afish177
Copy link

afish177 commented Jul 12, 2022

问题描述

简要描述您碰到的问题。
升级兼容版本 2.0.9 出现 转换实体 时间类型空串 默认1970 数据值
1.2.83 没这默认

环境信息

请填写以下信息:

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:Openjdk 1.8.0_201]
  • 版本信息:[e.g.:Fastjson 2.0.9]

重现步骤

如何操作可以重现该问题:

  1. 使用 JSON.parseObject方法
  2. 输入{"ieFlag":"I","isIgnore":"0","status":0,"ciqStatus":"","bizDate":"2022-07-12","ciqCommitType":"0","customMaster":"4732","cusType":"1","seqNo":"","preEntryId":"","entryId":"","iePort":"4732","manualNo":"E534118A0032","ieDate":"2022-07-12","ddate":""} 数据
  3. 出现 对应实体 ddate 属性 不是null 而是默认 1970-01-01 08:00:00 错误
//可在此输入示例代码

JSON.parseObject({"ieFlag":"I","isIgnore":"0","status":0,"ciqStatus":"","bizDate":"2022-07-12","ciqCommitType":"0","customMaster":"4732","cusType":"1","seqNo":"","preEntryId":"","entryId":"","iePort":"4732","manualNo":"E534118A0032","ieDate":"2022-07-12","ddate":""} , 实体.class);

期待的正确结果

对您期望发生的结果进行清晰简洁的描述。

对应实体 ddate 属性 应该是null 而不是默认1970 这样得数据 因为是空串

相关日志输出

请复制并粘贴任何相关的日志输出。
如图 调试 信息

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
image
image
image
image
image

@afish177 afish177 added the bug Something isn't working label Jul 12, 2022
@wenshao wenshao added this to the 2.0.10 milestone Jul 12, 2022
@afish177 afish177 changed the title [BUG] JSON.parseObject 实体时间格式 空串会默认 1970-01-01 08:00:00 [BUG] 兼容版本2.0.9 JSON.parseObject 实体时间格式 空串会默认 1970-01-01 08:00:00 Jul 12, 2022
@afish177 afish177 changed the title [BUG] 兼容版本2.0.9 JSON.parseObject 实体时间格式 空串会默认 1970-01-01 08:00:00 [BUG] 兼容版本2.0.9 JSON.parseObject 转换实体 时间格式空串会默认 1970-01-01 08:00:00属性值 Jul 12, 2022
@wenshao
Copy link
Member

wenshao commented Jul 13, 2022

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.10-SNAPSHOT/
问题已修复,请用2.0.10-SNAPSHOT版本验证,2.0.10版本预计在7月底发布

@afish177
Copy link
Author

afish177 commented Jul 13, 2022 via email

@afish177
Copy link
Author

afish177 commented Jul 13, 2022

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.10-SNAPSHOT/ 问题已修复,请用2.0.10-SNAPSHOT版本验证,2.0.10版本预计在7月底发布

我用的 是1.x的 兼容版本 包名不是fastjson2的

com.alibaba
fastjson
2.0.9

image

能否 给一个 这个2.0.10的 快照

@afish177
Copy link
Author

@afish177
Copy link
Author

@wenshao
Copy link
Member

wenshao commented Jul 23, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.10
问题已修复,请用新版本

@wenshao wenshao closed this as completed Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants