Browse Source

Improved error message and exceptions when model is null.

pull/41/head
Kalle Stenflo 10 years ago
parent
commit
e879a09b5a
  1. 3
      json-path/src/main/java/com/jayway/jsonpath/internal/spi/compiler/ArrayPathToken.java

3
json-path/src/main/java/com/jayway/jsonpath/internal/spi/compiler/ArrayPathToken.java

@ -38,6 +38,9 @@ class ArrayPathToken extends PathToken {
@Override
void evaluate(String currentPath, Object model, EvaluationContextImpl ctx) {
if(model == null){
throw new PathNotFoundException("The path " + currentPath + " is null");
}
if (!ctx.jsonProvider().isArray(model)) {
throw new InvalidPathException(format("Filter: %s can only be applied to arrays. Current context is: %s", toString(), model));
}

Loading…
Cancel
Save