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

Single choice() without otherwise() always executed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.7.0, 3.7.1
    • 3.7.2, 3.8.0
    • came-core
    • None
    • Unknown
    • Regression

    Description

      When building a route including a choice with a single when() and without an otherwise(), the first SimpleExpression-when() is always satisfied:

      from("direct:start")
          .choice()
              .when().simple(expression)
      		       // always routed to
      		       .to(whenTarget)
          .end()
          .to(end)
      

      An empty otherwise() restores choice logic:

      from("direct:start")
          .choice()
              .when().simple(expression).to(whenTarget)
              .otherwise()
          .end()
          .to(end)
      

      I included a simple Test-Case that fails with Camel 3.7.x and passes with Camel 3.6.x.

      Attachments

        1. SimpleChoiceTest.java
          2 kB
          Frank Wippermüller

        Activity

          People

            davsclaus Claus Ibsen
            fwippe Frank Wippermüller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: