Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18548

MessageContentsList no more converted into an InputStream by JsonPathEngine causes regressions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Workaround
    • 2.19.0
    • None
    • camel-cxfrs, camel-jsonpath
    • None
    • Unknown

    Description

      Since CAMEL-10646, a List is no more converted into an InpuStream by the JsonPathEngine but is directly treated as a List.

      This behavior change causes regressions on routes of the following type:

      from("cxfrs://...").setBody().jsonpath("$.name")

      where the related rest endpoint consumes JSON payload as next:

      @Path("/customer")
      @POST
      @Consumes({ "application/json" })
      @Produces({ "application/json" })
      Object createCustomer(String payload);

      The payload received is wrapped by the consumer endpoint into MessageContentsList which is now treated directly as a List instead of being converted into an InpuStream like before which causes an error of the following type:

      org.apache.camel.ExpressionEvaluationException: com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property ['name'] in path $ but found 'org.apache.cxf.message.MessageContentsList'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JacksonJsonProvider'.
      at org.apache.camel.jsonpath.JsonPathExpression.evaluate(JsonPathExpression.java:172) ~[classes/:?]
      at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45) ~[classes/:?]
      at org.apache.camel.processor.SetBodyProcessor.process(SetBodyProcessor.java:45) ~[classes/:?]
      at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:477) ~[classes/:?]
      at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181) ~[classes/:?]
      at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) ~[classes/:?]
      at org.apache.camel.processor.Pipeline.process(Pipeline.java:175) ~[classes/:?]
      at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:392) ~[classes/:?]

      Attachments

        Issue Links

          Activity

            People

              nfilotto Nicolas Filotto
              nfilotto Nicolas Filotto
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: