[
https://issues.apache.org/jira/browse/CAMEL-26965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-26965.
---------------------------------
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/30129 (merged to main as
fb713a6077f7).
_Claude Code on behalf of davsclaus_
> camel-core - interceptSendToEndpoint: process returns a value other than the
> one its callback is called with
> ------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26965
> URL: https://issues.apache.org/jira/browse/CAMEL-26965
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: shashank
> Assignee: shashank
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found by rule R3 of the exchange sanitizer (the {{AsyncProcessor}} contract:
> the value the callback is called with is the value {{process}} returns), on
> the camel-core test suite with {{-Psanitizer}}.
> {{InterceptSendToEndpointProcessor.process}} returns the value of the
> {{before}} processor of the interceptor (the route of
> {{interceptSendToEndpoint}}, or the before of a mock), but its callback is
> called with the value of what runs after it: the producer of the original
> endpoint, or the {{after}} processor ({{afterBefore}}: {{ac1}} calls
> {{callback.done(doneSync1)}}, and the return value of the rest of the chain
> is dropped). So:
> * the before goes through the reactive executor (a {{Pipeline}} returns
> {{false}}) and the producer is synchronous (such as {{mock}}): {{process}}
> returns {{false}} and the callback is called with {{true}};
> * the before is synchronous and the producer is asynchronous: {{process}}
> returns {{true}} and the callback is called with {{false}} later, on the
> producer's thread.
> Camel's own callers of a {{to}} step go on through the callback, so routes
> work today; a caller that uses the return value (as the {{AsyncProcessor}}
> Javadoc allows) would continue the exchange twice in the second case, or not
> at all in the first. The code before CAMEL-25140 had the same shape
> ({{callback.done(doneSync1)}}, and only {{doneSync && s}} returned).
> Seen in camel-core with {{-Psanitizer}}: RouteBuilderAddRoutesTest,
> RouteBuilderAddRoutesOnlyInterceptTest,
> RouteTemplateInterceptFromAndInterceptSendToEndpointWithPlaceholderTest and
> the other interceptSendToEndpoint tests (report RETURNED_FALSE_CALLBACK_TRUE
> at the {{to}} step).
> Fix: call the callback with the value of the whole chain ({{doneSync}} of the
> before and of what follows), and return the value of the rest of the chain
> when the before is done synchronously.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)