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]BigDecimal用JSONB反序列化时报错 #2954

Closed
deadpoolssr opened this issue Sep 11, 2024 · 1 comment
Closed

[BUG]BigDecimal用JSONB反序列化时报错 #2954

deadpoolssr opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@deadpoolssr
Copy link

deadpoolssr commented Sep 11, 2024

问题描述

BigDecimal用JSONB反序列化时报错

环境信息

请填写以下信息:
fastjson2版本:2.0.53_preview01
报错:
com.alibaba.fastjson2.JSONException: readInt32Value not support INT64 -56, offset 4/4

at com.alibaba.fastjson2.JSONBDump.readInt32Value(JSONBDump.java:637)
at com.alibaba.fastjson2.JSONBDump.dumpAny(JSONBDump.java:278)
at com.alibaba.fastjson2.JSONBDump.<init>(JSONBDump.java:45)
at com.alibaba.fastjson2.JSONB.toJSONString(JSONB.java:1288)

重现步骤

单测可以复现

  1. 使用 xxx.xxx 方法
  2. 输入 ... 数据
  3. 出现 ... 错误
    @Test
    public void testB() {

        BigDecimal numberInText2 = new BigDecimal("20.0");
        byte[] bytes = com.alibaba.fastjson2.JSONB.toBytes(numberInText2);
        String jsonString = com.alibaba.fastjson2.JSONB.toJSONString(bytes);
    }
@deadpoolssr deadpoolssr added the bug Something isn't working label Sep 11, 2024
@wenshao wenshao added this to the 2.0.53 milestone Sep 15, 2024
@wenshao wenshao self-assigned this Sep 15, 2024
@wenshao wenshao added the fixed label Sep 15, 2024
@wenshao
Copy link
Member

wenshao commented Sep 16, 2024

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

No branches or pull requests

2 participants