Browse Source

Merge pull request #322 from jochenberger/patch-5

Don't initialize Configuration if we don't need it
pull/325/head
kallestenflo 7 years ago committed by GitHub
parent
commit
9d8f29606f
  1. 4
      json-path/src/main/java/com/jayway/jsonpath/internal/filter/ValueNode.java

4
json-path/src/main/java/com/jayway/jsonpath/internal/filter/ValueNode.java

@ -805,9 +805,9 @@ public abstract class ValueNode {
}
public ValueNode evaluate(Predicate.PredicateContext ctx) {
Configuration c = Configuration.builder().jsonProvider(ctx.configuration().jsonProvider()).options(Option.REQUIRE_PROPERTIES).build();
if (isExistsCheck()) {
try {
Configuration c = Configuration.builder().jsonProvider(ctx.configuration().jsonProvider()).options(Option.REQUIRE_PROPERTIES).build();
Object result = path.evaluate(ctx.item(), ctx.root(), c).getValue(false);
return result == JsonProvider.UNDEFINED ? ValueNode.FALSE : ValueNode.TRUE;
} catch (PathNotFoundException e) {
@ -842,4 +842,4 @@ public abstract class ValueNode {
}
}
}

Loading…
Cancel
Save