Closed creky closed 1 year ago
这个问题修复过,可以帮忙用2.0.23版本做下验证么?
这个问题修复过,可以帮忙用2.0.23版本做下验证么?
经验证,2.0.23版本仍然 没有被修复。仍然报同样的错误。 调用的语句为:JSON.toJSONStringWithDateFormat(object, “yyyy-MM-dd HH:mm:ss”, SerializerFeature.WriteDateUseDateFormat);
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.24-SNAPSHOT/ 问题已修复,请用2.0.24-SNAPSHOT版本帮忙验证,2.0.24-SNAPSHOT预计在2月中旬发布。
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.24-SNAPSHOT/ 问题已修复,请用2.0.24-SNAPSHOT版本帮忙验证,2.0.24-SNAPSHOT预计在2月中旬发布。
经确认,已经修复~~~~
问题描述
2.0.16版本及以上报Cannot read field "child0" because "this.path" is null错误
环境信息
重现步骤
调用 jfinal.json.FastJson.toJson 方法
期待的正确结果
不要报错
相关日志输出
java.lang.NullPointerException: Cannot read field "child0" because "this.path" is null at com.alibaba.fastjson2.JSONWriter.setPath(JSONWriter.java:194) at com.alibaba.fastjson2.writer.ObjectWriterImplList.write(ObjectWriterImplList.java:365) at com.alibaba.fastjson.JSON.toJSONStringWithDateFormat(JSON.java:1760) at com.jfinal.json.FastJson.toJson(FastJson.java:55)
附加信息
经查原因是com.alibaba.fastjson2.JSONWriter#JSONWriter构造函数没有设置默认的path值。在里面设置个: path = JSONWriter.Path.ROOT; 就可以了?