-
Notifications
You must be signed in to change notification settings - Fork 547
Closed
Labels
Milestone
Description
问题描述
在processObjectInputSingleItemArray()函数中,修复https://github.com/alibaba/fastjson2/issues/1971问题时,2.0.58.android5分支没有正确修复。
环境信息
- OS信息: macOS 15.6.1 (24G90)
- JDK信息:1.8.0
- 版本信息:2.0.58.android5
重现步骤
protected T processObjectInputSingleItemArray(
JSONReader jsonReader,
Type fieldType,
Object fieldName,
long features
) {
String message = "expect {, but [, class " + this.typeName;
if (fieldName != null) {
message += ", parent fieldName " + fieldName;
}
String info = jsonReader.info(message);
long featuresAll = jsonReader.features(features);
if ((featuresAll & JSONReader.Feature.SupportSmartMatch.mask) != 0) {
Type itemType = fieldType == null ? this.objectClass : fieldType;
List list = jsonReader.readArray(itemType);
// 对比2.0.58的非安卓分支发现,下面的三行应该删除,不然可能会产生空指针bug
if (list.size() == 1) {
return (T) list.get(0);
}
if (list != null) {
if (list.size() == 0) {
return null;
}
if (list.size() == 1) {
return (T) list.get(0);
}
}
}
throw new JSONException(info);
}期待的正确结果
对您期望发生的结果进行清晰简洁的描述。
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
