You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Frank Wippermüller (Jira)" <ji...@apache.org> on 2021/01/26 15:50:00 UTC

[jira] [Updated] (CAMEL-16082) Single choice() without otherwise() always executed

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

Frank Wippermüller updated CAMEL-16082:
---------------------------------------
    Description: 
When building a route including a choice with a single {{when()}} and without an {{otherwise()}}, the first {{SimpleExpression}}-{{when()}} is always satisfied:

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

An empty {{otherwise()}} restores choice logic:

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

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



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

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

An empty {{otherwise()}} restores choice logic:

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

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




> Single choice() without otherwise() always executed
> ---------------------------------------------------
>
>                 Key: CAMEL-16082
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16082
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 3.7.0, 3.7.1
>            Reporter: Frank Wippermüller
>            Priority: Critical
>         Attachments: SimpleChoiceTest.java
>
>
> When building a route including a choice with a single {{when()}} and without an {{otherwise()}}, the first {{SimpleExpression}}-{{when()}} is always satisfied:
> {code:java}
> from("direct:start")
>     .choice()
>         .when().simple(expression)
> 		       // always routed to
> 		       .to(whenTarget)
>     .end()
>     .to(end)
> {code}
> An empty {{otherwise()}} restores choice logic:
> {code:java}
> from("direct:start")
>     .choice()
>         .when().simple(expression).to(whenTarget)
>         .otherwise()
>     .end()
>     .to(end)
> {code}
> I included a simple Test-Case that *fails with Camel 3.7.x* and *passes with Camel 3.6.x*.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)