-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix JSONReaderUTF8 nameValue1 for issue 2049 (#2410)
* fix(JSONReaderUTF8): 修复name的length=14位时,nameValue1计算 * test: add Issue2409 test 添加issue 2409的testcase
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/src/test/java/com/alibaba/fastjson2/issues_2400/Issue2409.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.alibaba.fastjson2.issues_2400; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import com.alibaba.fastjson2.JSONObject; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
/** | ||
* @author milabi | ||
* @since 2024-04-08 | ||
*/ | ||
public class Issue2409 { | ||
@Test | ||
void test() { | ||
String s = "{\"CABCB9281415LR\":{\"key\":\"CABCB9281415LR\",\"type\":\"分类1\"},\"CABCB9261415LR\":{\"key\":\"CABCB9261415LR\",\"type\":\"分类2\"}}"; | ||
byte[] bytes = s.getBytes(StandardCharsets.UTF_8); | ||
JSONObject jsonObject = JSON.parseObject(bytes); | ||
Assertions.assertEquals(s, JSON.toJSONString(jsonObject)); | ||
} | ||
} |