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

camel-core - Using predicates in Java DSL with ValueBuilder should init as predicate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.13.0
    • 3.14.0
    • camel-core
    • None
    • Unknown

    Description

      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

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: