You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class A {
public static void main(String[] args) {
byte[] bytes = JSONB.toBytes(new Data());
Object o = JSONB.parseObject(bytes, Data.class, JSONReader.Feature.FieldBased);
System.out.println(o.getClass());
}
static class Data implements Serializable {
private String mData = "";
public Data() {
}
public String getData() {
return mData;
}
public void setData(String data) {
mData = data;
}
}
}
日志:
Exception in thread "main" java.lang.IllegalAccessError: tried to access class org.apache.dubbo.common.serialize.fastjson2.Fastjson2SecurityManager$Data from class com.alibaba.fastjson2.reader.ObjectReader_1
at com.alibaba.fastjson2.reader.ObjectReader_1.createInstance(Unknown Source)
at com.alibaba.fastjson2.reader.ObjectReader_1.readJSONBObject(Unknown Source)
at com.alibaba.fastjson2.JSONB.parseObject(JSONB.java:542)
at org.apache.dubbo.common.serialize.fastjson2.Fastjson2SecurityManager.main(Fastjson2SecurityManager.java:121)
其他信息
不使用 FieldBased 模式,正常
删除构造器,正常
内部类改公开,正常
修改 field 的名字和 getter setter 名字一样,报错
The text was updated successfully, but these errors were encountered:
问题描述
简要描述您碰到的问题。
内部类公开构造器使用 FieldBased 模式反序列化失败
重现步骤
测试用例:
日志:
其他信息
The text was updated successfully, but these errors were encountered: