Skip to content
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

用jsonpath替换字符串中的值时,如果成员变量是类A,但是这个类没有被初始化,那么替换类A的成员时会报异常 #995

Closed
zhanghc1124 opened this issue Jan 13, 2017 · 1 comment
Labels
Milestone

Comments

@zhanghc1124
Copy link

zhanghc1124 commented Jan 13, 2017

版本1.2.16、1.2.23均有该问题

异常如下:
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.alibaba.fastjson.parser.deserializer.FieldDeserializer.setValue(FieldDeserializer.java:90)
at com.alibaba.fastjson.JSONPath.setPropertyValue(JSONPath.java:2254)
at com.alibaba.fastjson.JSONPath$PropertySegement.setValue(JSONPath.java:1298)
at com.alibaba.fastjson.JSONPath.set(JSONPath.java:284)
at com.alibaba.fastjson.JSONPath.set(JSONPath.java:349)

测试代码如下:
public void test() {
Person per = new Person();
System.out.println("原生Person:" + per.toString());
String path = "$.nose.name";
String value = "noseName";
Object obj = value;
JSONPath.set(per, path, obj);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants