I don't know the groovy version but simple language has null safe operator.
Can't you write it like this:

.setProperty("source").simple("${request.body.source?")

See here for examples:
http://camel.apache.org/simple.html

On Wed, May 10, 2017 at 3:32 PM, Mic [via Camel] <
ml+s465427n5799230...@n5.nabble.com> wrote:

> Hi,
>
> it found a solution which works but it is not really nice to me.. any
> ideas to make it smarter?
>
> ......
> choice().when(body().convertToString().contains("\"
> source\"")).setProperty("source").groovy("request.body.source").end()
> .......
>
> Best regards
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Problem-using-setProperty-
> with-groovy-on-optional-Field-tp5799222p5799230.html
> To start a new topic under Camel - Users, email ml+s465427n465428h31@n5.
> nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-using-setProperty-with-groovy-on-optional-Field-tp5799222p5799231.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to