Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20999

OnException - Handler is invoked twice per exception when handled(false) is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Cannot Reproduce
    • 4.4.2
    • 4.x
    • came-core
    • None
    • Camel 4.4.2 with SpringBoot 3.2.7 and JDK 17 on Windows.

    • Unknown

    Description

      Run the following route, the onException handler would be executed twice.  The counter will be 2.

      int counter = 0
      from("timer://testRoute2?repeatCount=1").routeId('testRoute_timer2').autoStartup(true)
      .onException(IllegalArgumentException).onWhen({it.getException().toString().contains('foo')})
      .process(

      Unknown macro: { counter++ println "print in onException foo $counter" }

      ).handled(false)
      .end()
      .log('in testRoute2')
      .process(

      Unknown macro: { println 'before throwing exception' throw new IllegalArgumentException("foo") }

      )

      This would generate the following:
       

      2024-07-19 17:46:11.711 [Camel (camel-1) thread #31 - timer://testRoute2] testRoute_timer2 - in testRoute2
      before throwing exception
      print in onException foo 1
      print in onException foo 2

      If the handled(true) is used, the handler would only run once.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bocamel John Yin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: