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 2021/11/23 14:17:00 UTC

[jira] [Created] (CAMEL-17225) camel-core - Using predicates in Java DSL with ValueBuilder should init as predicate

Claus Ibsen created CAMEL-17225:
-----------------------------------

             Summary: camel-core - Using predicates in Java DSL with ValueBuilder should init as predicate
                 Key: CAMEL-17225
                 URL: https://issues.apache.org/jira/browse/CAMEL-17225
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 3.13.0
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 3.14.0


Reported on user mailing list



Can anybody pls. give me a hint whether there is a change between Camel 3.13.0 and 3.11.3 which might cause the following behavior?
The body is a list having one entry.
In 3.11.3 the or() evaluates to false.
In 3.13.0 the or() evaluates to true.
Is there anything I overlooked?

.process(e->e.getMessage().setBody(Collections.singletonList("AN ENTRY")))
                .choice()
                    .when(body().isNull())
                        .log(INFO,"There is no list")
                    .otherwise()
                        .log(INFO,"There is a list")
                .end()

                .choice()
                    .when(simple("${body.size()} == 0"))
                        .log(INFO,"The list has no entries")
                    .otherwise()
                        .log(INFO,"The list has entries")
                .end()

                .choice()
                    .when(or(body().isNull(),simple("${body.size()} == 0")))
                        .log(INFO,"There is no list or the list has no entries")
                   .otherwise()
                        .log(INFO,"There is a list having at least an entry")
                .end()

Running that route with 3.11.3 results in:
INFO                          test.route 481523C07BAAEC8-0000000000000006 There is a list
INFO                          test.route 481523C07BAAEC8-0000000000000006 The list has entries
INFO                          test.route 481523C07BAAEC8-0000000000000006 There is a list having at least an entry

Running that route with 3.13.0 results in:
INFO                          test.route 2BB218D90DB24AB-0000000000000016 There is a list
INFO                          test.route 2BB218D90DB24AB-0000000000000016 The list has entries
INFO                          test.route 2BB218D90DB24AB-0000000000000016 There is no list or the list has no entries



Mit freundlichen Grüßen / Best regards

Andreas Klug



--
This message was sent by Atlassian Jira
(v8.20.1#820001)