Browse Source

Don't initialize Configuration if we don't need it

pull/322/head
jochenberger 8 years ago committed by GitHub
parent
commit
ed783b5806
  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) { public ValueNode evaluate(Predicate.PredicateContext ctx) {
Configuration c = Configuration.builder().jsonProvider(ctx.configuration().jsonProvider()).options(Option.REQUIRE_PROPERTIES).build();
if (isExistsCheck()) { if (isExistsCheck()) {
try { 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); Object result = path.evaluate(ctx.item(), ctx.root(), c).getValue(false);
return result == JsonProvider.UNDEFINED ? ValueNode.FALSE : ValueNode.TRUE; return result == JsonProvider.UNDEFINED ? ValueNode.FALSE : ValueNode.TRUE;
} catch (PathNotFoundException e) { } catch (PathNotFoundException e) {
@ -842,4 +842,4 @@ public abstract class ValueNode {
} }
} }

Loading…
Cancel
Save