Nicolas Filotto created CAMEL-18548:
---------------------------------------

             Summary: MessageContentsList no more converted into an InputStream 
by JsonPathEngine causes regressions
                 Key: CAMEL-18548
                 URL: https://issues.apache.org/jira/browse/CAMEL-18548
             Project: Camel
          Issue Type: Improvement
          Components: camel-cxfrs, camel-jsonpath
    Affects Versions: 2.19.0
            Reporter: Nicolas Filotto
            Assignee: Nicolas Filotto
             Fix For: 3.18.3, 3.20.0


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/:?]}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to