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
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)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.builder.BinaryPredicateSupport.matches(BinaryPredicateSupport.java:54)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.builder.PredicateBuilder$5.matches(PredicateBuilder.java:127)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:46)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:263)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at CamelBug$ComponentImplementation$1$2.start(CamelBug.java:60)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/test-classes/:]
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1529)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1795)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1748)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1674)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1464)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1356)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1257)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1235)[file:/C:/Development/workspaces/camelcode/camel/camel-core/target/classes/:]
{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
> 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