[ 
https://issues.apache.org/jira/browse/CAMEL-3433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen reassigned CAMEL-3433:
----------------------------------

    Assignee: Claus Ibsen

> Undefined header results in Nullpointer when expression is evaluated
> --------------------------------------------------------------------
>
>                 Key: CAMEL-3433
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3433
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Thomas Jung
>            Assignee: Claus Ibsen
>             Fix For: 2.6.0
>
>
> If you define a filter for a header that is not defined like
> from("p:a").filter(header("header").in("value")).to("p:b");
> it results in a NullPointerException:
> {code}
> 2010-12-15 10:07:45,920 [main] ERROR DefaultErrorHandler            - 
> Failed delivery for exchangeId: 0215-1237-1292404064936-0-2. 
> Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException
>       at 
> org.apache.camel.builder.ExpressionBuilder$40.evaluate(ExpressionBuilder.java:955)
>       at 
> org.apache.camel.impl.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)
>       at 
> org.apache.camel.builder.BinaryPredicateSupport.matches(BinaryPredicateSupport.java:54)
>       at 
> org.apache.camel.builder.PredicateBuilder$5.matches(PredicateBuilder.java:127)
>       at 
> org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:46)
>       at 
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
>       at 
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>       at 
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
> {code}
> This test reproduces the problem:
> {code}
> public void testExpressionForUndefinedHeader(){
>     Expression type = ExpressionBuilder.headerExpression("header");
>     Expression expression = ExpressionBuilder.constantExpression("value");
>     Expression convertToExpression = 
> ExpressionBuilder.convertToExpression(expression, type);
>     convertToExpression.evaluate(exchange, Object.class);
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to