[BUG] JSON.parseObject with empty string and byte[].class
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
#464 fastjson兼容 解析空字符串的byte[] 出现异常值
### 环境信息
- OS信息: [MacOS 12.7.4 M1 Pro 16 GB]
- JDK信息: [Openjdk 17.0.6]
- 版本信息:[Fastjson 2.0.51]
### 重现步骤
```java
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
Contributor guide
Research direction
Start by running the Issue464 reproducer with Java, Fastjson 2.0.51, and the empty-string input passed to JSON.parseObject with byte[].class. Trace the byte[] deserialization behavior and add or update a regression test so the assertion returns null instead of a byte array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100