Nicolas Filotto created CAMEL-18547:
---------------------------------------
Summary: MessageContentsList no more converted into an InputStream
by JsonPathEngine causes regressions
Key: CAMEL-18547
URL: https://issues.apache.org/jira/browse/CAMEL-18547
Project: Camel
Issue Type: Improvement
Components: camel-cxf, camel-jsonpath
Affects Versions: 2.19.4
Reporter: Nicolas Filotto
Assignee: Nicolas Filotto
Fix For: 3.18.3, 3.20.0
Since the addition CAMEL-10646, a List is no more converted into an InpuStream
by the JsonPathEngine but directly treated as a List.
This behavior change causes regressions on route of 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 not treated directly as a List instead of being
converted into an InpuStream like before which causes an error of 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)