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

Using simple language OGNL expressions doesn't work for Bean Binding when a field is null

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      The following functionality doesn't work, when one of the fields is null:

      http://camel.apache.org/bean-binding.html

      You can also use the OGNL support of the Simple expression language. Now suppose the message body is an object which has a method named asXml. To invoke the asXml method we can do as follows:

      .bean(OrderService.class, "doSomething(${body.asXml}, ${header.high})")

      Instead of using .bean as shown in the examples above, you may want to use .to instead as shown:

      .to("bean:orderService?method=doSomething(${body.asXml}, ${header.high})")

      A test case is provided. Instead of getting values of fields "foo" and "bar" respectively, the first parameter (which should be null) receives value of pojo.toString(), while the second parameter receives the correct value.

      Attachments

        1. CamelBeanMethodOgnlFieldTest.java
          2 kB
          Anton Koscejev

        Activity

          People

            davsclaus Claus Ibsen
            koscejev Anton Koscejev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: