-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 反序列化null的list报错 #2233
Comments
是这个错误吗?
|
rowstop
added a commit
to rowstop/fastjson2
that referenced
this issue
Feb 4, 2024
可以加上泛型 如 |
3 tasks
@rowstop 不是npe,报错是我贴的代码的最后一行:throw new JSONException(jsonReader.info("TODO : " + this.getClass())); 类型没问题, |
没复现,按理说如果是 null 应该走不到这里,前面就直接返回了 |
哦,没有无参构造方法是不? |
rowstop
added a commit
to rowstop/fastjson2
that referenced
this issue
Feb 4, 2024
是的,估计用的lombok 的 builder,所以没有默认的无参构造方法 |
wenshao
pushed a commit
that referenced
this issue
Feb 5, 2024
wenshao
pushed a commit
that referenced
this issue
Feb 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
简要描述您碰到的问题。
比如
{"log_entries": null}
应该被正常反序列化,现在会报错TODO : class com.alibaba.fastjson2.reader.FieldReaderListField
在对应的类型上有注解:
@JsonProperty("log_entries") private List<LogEntry> logEntries;
版本:2.0.46
附加信息
如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。
报错来源是FieldReaderList的readFieldValue(JSONReader jsonReader)方法,看起来这个方法里没有判断jsonReader是不是 null
是不是应该在最后的throw new JSONException判断是否是null?是null就返回 null?
The text was updated successfully, but these errors were encountered: