shashank created CAMEL-26907:
--------------------------------
Summary: camel-core - an Error thrown by an advice of a route
(rest binding, route policy, variables) or by the result processor of a
template send skips the end of the unit of work
Key: CAMEL-26907
URL: https://issues.apache.org/jira/browse/CAMEL-26907
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26741: the advices of {{CamelInternalProcessor}} and the
code around them still catch only {{Exception}}, so an {{Error}} that is not a
{{VirtualMachineError}} (for example a {{NoClassDefFoundError}} of a data
format) thrown by an advice escapes, without the after of the advices that
already ran (the end of the unit of work, the inflight registry), and the
exchange stays inflight:
* the loop over the advices in {{CamelInternalProcessor.process}}, of a route
and of each step (the {{before}} of {{RestBindingAdvice}}, the REST OpenAPI and
Postman advices, the {{VariableAdvice}} of {{variableReceive}}, the unit of
work, the debugger of a step, ...) and {{AdviceIterator.runAfterTask}} (their
{{after}}: an {{Error}} there skips the {{after}} of the advices before it,
among them the end of the unit of work);
* {{RoutePolicyAdvice}}: an exception of {{RoutePolicy.onExchangeBegin}} or
{{onExchangeDone}} is logged and ignored, so the other policies are still
called, but an {{Error}} escapes (and with it the steps above);
* {{SharedCamelInternalProcessor}} (the sends of a {{ProducerTemplate}}): its
advice {{before}}, the producer of a transacted send (the callback is not
called in {{finally}}), and the result processor of {{template.send(endpoint,
pattern, processor, resultProcessor)}} or {{asyncSend}} with a result
processor: an {{Error}} of the result processor skips the end of the unit of
work and the callback, so an asynchronous send can never complete when the
endpoint answers on another thread.
Expected: as for the processors after CAMEL-26741, such an {{Error}} fails the
exchange (for a route policy: it is logged and ignored, as an exception is),
and a {{VirtualMachineError}} is left as before.
The input and output type of a route ({{ContractAdvice}}) and the transacted
step were fixed with CAMEL-26866.
Listed as a follow-up in CAMEL-26866 (found in the review of CAMEL-26824);
confirmed with tests on the real classes.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)