Caused by: java.lang.NullPointerException
at com.alibaba.fastjson.serializer.SerializeWriter.writeFieldValueStringWithDoubleQuoteCheck(SerializeWriter.java:1869)
at com.alibaba.fastjson.serializer.SerializeWriter.writeFieldValue(SerializeWriter.java:1854)
at com.alibaba.fastjson.serializer.ASMSerializer_2_UserDetail.writeNormal(Unknown Source)
at com.alibaba.fastjson.serializer.ASMSerializer_2_UserDetail.write(Unknown Source)
at com.alibaba.fastjson.serializer.ASMSerializer_1_ZMessage.writeNormal(Unknown Source)
at com.alibaba.fastjson.serializer.ASMSerializer_1_ZMessage.write(Unknown Source)
at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:312)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:793)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:731)
at cn.easyes.core.conditions.BaseEsMapperImpl.buildJsonIndexSource(BaseEsMapperImpl.java:1153)
at cn.easyes.core.conditions.BaseEsMapperImpl.buildIndexRequest(BaseEsMapperImpl.java:876)
当去除掉项目中的 json 过滤器则可以解析成功。
String json = JSON.toJSONString(zMessage, SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.WriteMapNullValue);
Caused by: java.lang.NullPointerException at com.alibaba.fastjson.serializer.SerializeWriter.writeFieldValueStringWithDoubleQuoteCheck(SerializeWriter.java:1869) at com.alibaba.fastjson.serializer.SerializeWriter.writeFieldValue(SerializeWriter.java:1854) at com.alibaba.fastjson.serializer.ASMSerializer_2_UserDetail.writeNormal(Unknown Source) at com.alibaba.fastjson.serializer.ASMSerializer_2_UserDetail.write(Unknown Source) at com.alibaba.fastjson.serializer.ASMSerializer_1_ZMessage.writeNormal(Unknown Source) at com.alibaba.fastjson.serializer.ASMSerializer_1_ZMessage.write(Unknown Source) at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:312) at com.alibaba.fastjson.JSON.toJSONString(JSON.java:793) at com.alibaba.fastjson.JSON.toJSONString(JSON.java:731) at cn.easyes.core.conditions.BaseEsMapperImpl.buildJsonIndexSource(BaseEsMapperImpl.java:1153) at cn.easyes.core.conditions.BaseEsMapperImpl.buildIndexRequest(BaseEsMapperImpl.java:876) 当去除掉项目中的 json 过滤器则可以解析成功。 String json = JSON.toJSONString(zMessage, SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.WriteMapNullValue);
ZMessage { @IndexId(type = IdType.NONE) @ApiModelProperty("nosql主键") private String id; @ApiModelProperty("指令 对应数据字典type值 cmd") private Integer cmd; @ApiModelProperty("消息体") @JSONField(name="body") private Object body; @ApiModelProperty(" true是回执消息,false为非回执消息") private Boolean ack = false; @ApiModelProperty("metadata 元数据自定义 K,V") public Map<String,String> metadata; @ApiModelProperty("用户信息") private UserDetail user; @ApiModelProperty("是否进行回调通知 true 是 false 否") private Boolean ackNotify = false; /**
}
UserDetail { /**
性别 */ @ApiModelProperty("性别") @JSONField(name="sex") private String sex;
@ApiModelProperty("设备ID") @JSONField(name="deviceId") private String deviceId;
@ApiModelProperty("sdk类型") @JSONField(name="type") private String type;
}
版本 esay-es 1.1.0 fastjson 1.2.83