Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-7318

jsonpath expression eval failure when jsonnode contains SECRET or WORKFLOW properties

XMLWordPrintable

    • False
    • None
    • False
    • ---
    • ---
    • 2022 Week 20-22 (from May 16)

      When JsonPathExpression#eval method is called with a JsonNode context that defines properties SECRET or WORKFLOW (which are reserved keywords) then following exception occurs for the "Recursive descent" operator (https://github.com/json-path/JsonPath#operators):

      ..property
      
      java.lang.ClassCastException: class org.kie.kogito.expr.jsonpath.WorkflowJacksonJsonNodeJsonProvider$$Lambda$399/0x00000008002fd440 cannot be cast to class com.fasterxml.jackson.databind.node.ObjectNode (org.kie.kogito.expr.jsonpath.WorkflowJacksonJsonNodeJsonProvider$$Lambda$399/0x00000008002fd440 and com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module of loader 'app')
      
      	at com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider.toJsonObject(JacksonJsonNodeJsonProvider.java:247)
      	at com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider.getPropertyKeys(JacksonJsonNodeJsonProvider.java:196)
      	at com.jayway.jsonpath.internal.path.ScanPathToken$PropertyPathTokenPredicate.matches(ScanPathToken.java:202)
      	at com.jayway.jsonpath.internal.path.ScanPathToken.walkObject(ScanPathToken.java:75)
      	at com.jayway.jsonpath.internal.path.ScanPathToken.walk(ScanPathToken.java:41)
      	at com.jayway.jsonpath.internal.path.ScanPathToken.walkObject(ScanPathToken.java:84)
      	at com.jayway.jsonpath.internal.path.ScanPathToken.walk(ScanPathToken.java:41)
      	at com.jayway.jsonpath.internal.path.ScanPathToken.evaluate(ScanPathToken.java:36)
      	at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
      	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:99)
      	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:107)
      	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:185)
      	at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:89)
      	at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:78)
      	at org.kie.kogito.expr.jsonpath.JsonPathExpression.eval(JsonPathExpression.java:68)
      	at org.kie.kogito.expr.jsonpath.JsonPathExpression.eval(JsonPathExpression.java:99)
      	at org.kie.kogito.expr.jsonpath.JsonPathExpressionHandlerTest.testCollectFromArrayJsonNodeRecursive(JsonPathExpressionHandlerTest.java:116)
      ...

      The reproducing test case is added as part of KOGITO-7127, but disabled for now. Needs to be enabled as part of the fix.

              ftirados Francisco Javier Tirado Sarti
              jstastny@redhat.com Jan Stastny
              Jan Stastny Jan Stastny
              Jan Stastny Jan Stastny
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: