use of com.jayway.jsonpath.InvalidPathException in project intellij-community by JetBrains.
the class JsonPathResponseHandler method extractRawValue.
@Nullable
private Object extractRawValue(@NotNull Selector selector, @NotNull String source) throws Exception {
if (StringUtil.isEmpty(selector.getPath())) {
return null;
}
JsonPath jsonPath = lazyCompile(selector.getPath());
Object value;
try {
value = jsonPath.read(source);
} catch (InvalidPathException e) {
throw new Exception(String.format("JsonPath expression '%s' doesn't match", selector.getPath()), e);
}
if (value == null) {
return null;
}
return value;
}
Aggregations