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] fastjson throws fastjson2.JSONException #2998

Open
Cooper-Zhong opened this issue Oct 6, 2024 · 0 comments
Open

[BUG] fastjson throws fastjson2.JSONException #2998

Cooper-Zhong opened this issue Oct 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Cooper-Zhong
Copy link
Contributor

问题描述

fastjson.JSON.parseObject throws fastjson2.JSONException

环境信息

  • OS信息: [MacOS 12.7.4 M1 Pro 16 GB]
  • JDK信息: [Openjdk 17.0.6]
  • 版本信息:[Fastjson 2.0.53]

重现步骤

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import org.junit.jupiter.api.Test;

public class temp {
    static String BinaryString = "10101100 00010100 11100001 11000100";
    static String[] binaryArray = BinaryString.split(" ");
    
    @Test
    public void test1() {
        byte[] byteArray = new byte[binaryArray.length];

        for (int i = 0; i<binaryArray.length; i++) {
            byteArray[i] = (byte) Integer.parseInt(binaryArray[i], 2);
        }
        try {
            JSON.parseObject(byteArray);
        } catch (JSONException e) {
            System.out.println(e);
        }
    }
}
@Cooper-Zhong Cooper-Zhong added the bug Something isn't working label Oct 6, 2024
Cooper-Zhong added a commit to Cooper-Zhong/fastjson2 that referenced this issue Oct 6, 2024
@Cooper-Zhong Cooper-Zhong mentioned this issue Oct 6, 2024
3 tasks
Cooper-Zhong added a commit to Cooper-Zhong/fastjson2 that referenced this issue Oct 7, 2024
Cooper-Zhong added a commit to Cooper-Zhong/fastjson2 that referenced this issue Oct 7, 2024
wenshao pushed a commit that referenced this issue Oct 7, 2024
* fix issue #2997 throws NullPointerException

* fix issue #2998 fastjson-compatible parseObject throws fastjson2.JSONException
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

1 participant