You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/09/29 05:36:00 UTC

[jira] [Resolved] (CAMEL-25113) camel-core - onException configuration: fix bugs found in a deep review

     [ https://issues.apache.org/jira/browse/CAMEL-25113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-25113.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/27019

> camel-core - onException configuration: fix bugs found in a deep review
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-25113
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25113
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> A review of the onException configuration found these bugs:
> # The {{onWhen}} predicate of {{onException}} is not created when the route is created (unlike {{handled}}, {{continued}}, {{retryWhile}} and the onWhen of other EIPs), but evaluated from the model at runtime. So property placeholders of route templates in the onWhen fail at runtime ({{Property with key [code] not found}}), and an invalid onWhen expression is not detected when the route is created but only when an exception is thrown.
> # An {{onException}} that is only configured with {{redeliveryPolicyRef}} (or {{onExceptionOccurredRef}}) fails with {{is not configured}} (CAMEL-11080 only fixed this for the redeliveryPolicy object).
> # A class name in {{onException}} that is not an exception (such as {{java.lang.String}} in XML/YAML) is accepted and never matches; it now fails when the route is created.
> Documentation:
> * How Camel selects the onException is described as "first match starting from the bottom (nested caused by)", but Camel selects the closest match across the thrown exception and all its causes (and the most nested one when equally close), a route scoped onException wins over a context scoped when equally close, and when the same exception is configured more than once the last one is used (and the ones from route configurations are added after the ones in the RouteBuilder).
> * When any redelivery option is configured on an onException, its redelivery policy is based on the error handler (and uses its maximumRedeliveries).
> _Claude Code on behalf of Claus Ibsen_



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