fastjson2 icon indicating copy to clipboard operation
fastjson2 copied to clipboard

[BUG] JSON.parseObject with empty string and byte[].class

Open Cooperzzy opened this issue 1 year ago • 0 comments

问题描述

#464 fastjson兼容 解析空字符串的byte[] 出现异常值

环境信息

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

重现步骤

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNull;

public class Issue464 {

    @Test
    public void test1() {
        assertNull(JSON.parseObject("\"\"", byte[].class));
    }
}

相关日志输出

Expected :null Actual :[B@6c130c45

Cooperzzy avatar Jun 25 '24 13:06 Cooperzzy