When i searching something not found using the JsonSurferJackson instance as below.
JsonSurfer surfer = JsonSurferJackson.INSTANCE;
surfer.collectOne(read("sample.json"), "$..authors"); // no authors in sample.json
Then I get a NullPointerException as below.
java.lang.NullPointerException
at com.fasterxml.jackson.databind.ObjectMapper.treeToValue(ObjectMapper.java:2738)
at org.jsfr.json.provider.JacksonProvider.cast(JacksonProvider.java:115)
at org.jsfr.json.provider.JacksonProvider.cast(JacksonProvider.java:35)
at org.jsfr.json.JsonSurfer.collectOne(JsonSurfer.java:418)
at org.jsfr.json.JsonSurfer.collectOne(JsonSurfer.java:400)
at org.jsfr.json.JsonSurfer.collectOne(JsonSurfer.java:389)
...
So I debug it, found that problem cause by calling org.jsfr.json.provider.JacksonProvider#cast with null JsonNode param,because there's no null value checking nethier in org.jsfr.json.provider.JacksonProvider#cast nor in com.fasterxml.jackson.databind.ObjectMapper#treeToValue.
This pull request to fix ahead problem.
The problen was not found when using the three other providers (Gson, JsonSimple, Fastjson ).
When i searching something not found using the JsonSurferJackson instance as below.
Then I get a NullPointerException as below.
So I debug it, found that problem cause by calling
org.jsfr.json.provider.JacksonProvider#cast
with null JsonNode param,because there's no null value checking nethier inorg.jsfr.json.provider.JacksonProvider#cast
nor incom.fasterxml.jackson.databind.ObjectMapper#treeToValue
.This pull request to fix ahead problem.
The problen was not found when using the three other providers (Gson, JsonSimple, Fastjson ).