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][不兼容]解析带有超大数字的json时,fastjson1 直接报错,但是fastjson2却将数字截断,未报错。 #1357

Closed
xiaoxiao556655 opened this issue Apr 13, 2023 · 5 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@xiaoxiao556655
Copy link

[BUG][不兼容]解析带有超大数字的json时,fastjson1 直接报错,但是fastjson2却将数字截断,未报错。

@xiaoxiao556655 xiaoxiao556655 added the bug Something isn't working label Apr 13, 2023
@wenshao
Copy link
Member

wenshao commented Apr 13, 2023

多大的数字?能提供重现问题的testcase么?

@xiaoxiao556655
Copy link
Author

xiaoxiao556655 commented Apr 13, 2023

@Data
@Builder
@NoArgsConstructor
class PersonTest {

    private Integer pSsrc;

    private String pUserId;

    private boolean flag;

    private Map<String, String> map;

    public PersonTest(int pSsrc, String pUserId, boolean flag, Map<String, String> map) {
        super();
        this.pSsrc = pSsrc;
        this.pUserId = pUserId;
        this.flag = flag;
        this.map = map;
    }
}

String t1 = "{\"flag\":false,\"pSsrc\":6666665678858,\"pUserId\":\"\"}";
PersonTest t2 = com.alibaba.fastjson2.JSON.parseObject(t1, PersonTest.class);
t2 = com.alibaba.fastjson.JSON.parseObject(t1, PersonTest.class);

@wenshao wenshao added this to the 2.0.28 milestone Apr 13, 2023
@wenshao
Copy link
Member

wenshao commented Apr 13, 2023

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.28-SNAPSHOT/
问题已修复,请帮忙有2.0.8-SNAPSHOT版本验证,2.0.28版本预计会在周末发布

@wenshao wenshao added the fixed label Apr 13, 2023
@wenshao
Copy link
Member

wenshao commented Apr 15, 2023

@wenshao wenshao closed this as completed Apr 15, 2023
@Hatawenzi
Copy link

Hatawenzi commented Apr 27, 2023

还是有问题,譬如2147483666,10270867890这些还是能正常转换Integer,但结果不对

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

3 participants