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

Single choice() without otherwise() always executed

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7.0, 3.7.1
    • Fix Version/s: 3.7.2, 3.8.0
    • Component/s: came-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Regression:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: