Hi

Language lan = context.resolveLanguage("simple")
Predicate p = lan.createPredicate(....)
p.init(context)



On Mon, Jan 17, 2022 at 5:50 PM Steve973 <steve...@gmail.com> wrote:
>
> Hello.  I am trying to create a Predicate from an Expression.  The
> Expression is created from a String.  This is what I am trying to do:
>
> String language = "simple";
> String value = "${body} contains 'test'";
> Expression expression = ExpressionBuilder.languageExpression(language,
> value);
> Predicate predicate = PredicateBuilder.toPredicate(expression);
>
> My debugging output *looks* like I am creating it properly:
> predicate: language[simple:${body} contains 'test']
>
> But when I try to use this when processing an Exchange, I am getting a null
> pointer exception:
> java.lang.NullPointerException: null
>         at
> org.apache.camel.support.builder.ExpressionBuilder$22.matches(ExpressionBuilder.java:784)
> ~[camel-support-3.15.0-SNAPSHOT.jar:3.15.0-SNAPSHOT]
>
> Can anyone give me an idea about what I might be missing?
>
> Thanks,
> Steve



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to