fix remove second null for issue #3485

This commit is contained in:
yanxutao89 2025-04-10 00:04:19 +08:00
parent c9273e8f88
commit 3236d8014c
3 changed files with 27 additions and 1 deletions

View File

@ -19,7 +19,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-20.04, windows-latest, macos-latest ] os: [ ubuntu-20.04, windows-latest, macos-latest ]
java: [ 8, 11, 17, 21 ] java: [ 8, 11, 17, 21, 23 ]
fail-fast: false fail-fast: false
max-parallel: 16 max-parallel: 16
name: Test on JDK ${{ matrix.java }} OS ${{ matrix.os }} name: Test on JDK ${{ matrix.java }} OS ${{ matrix.os }}

View File

@ -2746,6 +2746,7 @@ public abstract class JSONReader
} }
case '/': case '/':
skipComment(); skipComment();
--i;
continue; continue;
default: default:
throw new JSONException(info()); throw new JSONException(info());

View File

@ -0,0 +1,25 @@
package com.alibaba.fastjson2.issues_3400;
import com.alibaba.fastjson2.*;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Issue3485 {
@Test
public void test() throws Exception {
String json = "{\n" +
" \"file_list\": [\n" +
" 11, // CreateBlogRequest.java - 可能需要修改以支持删除操作\n" +
" 13, // BlogRepository.java - 需要添加删除方法\n" +
" 22, // CreateBlogResponse.java - 可能需要修改以支持删除操作的响应\n" +
" 26, // BlogService.java - 需要添加删除博客的业务逻辑\n" +
" 27, // BlogPost.java - 可能需要修改以支持删除操作\n" +
" 29, // BlogController.java - 需要添加删除博客的API\n" +
" 33 // BlogServiceTest.java - 需要添加删除博客的测试用例\n" +
" ]\n" +
" }";
JSONObject jsonObject = JSON.parseObject(json);
assertEquals("{\"file_list\":[11,13,22,26,27,29,33]}", jsonObject.toJSONString());
}
}