camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Jung (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CAMEL-3433) Undefined header results in Nullpointer when expression is evaluated
Date Wed, 15 Dec 2010 09:21:02 GMT

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

Thomas Jung updated CAMEL-3433:
-------------------------------

    Description: 
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}

  was:
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
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}


> 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
>
> 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.


Mime
View raw message