camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert H. Pollack (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (CAMEL-993) NPE in TraceFormatter
Date Mon, 08 Jun 2009 16:24:35 GMT

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

Robert H. Pollack reopened CAMEL-993:
-------------------------------------


I am experiencing the same problem in 1.6.0, without an aggregator. My route logic (in XML)
is

      <route errorHandlerRef="myErrorHandler">
         <from uri="jbi:service:urn:distributor.dmf.company.com:DistributorService"/>
         <convertBodyTo type="java.lang.String"/>
         <inOnly uri="direct:packetQueue"/>
      </route>

My stack trace is

java.lang.NullPointerException
        at org.apache.camel.processor.interceptor.TraceFormatter.getBreadCrumbID(TraceFormatter.java:202)
        at org.apache.camel.processor.interceptor.TraceFormatter.getExchangeAndNode(TraceFormatter.java:271)
        at org.apache.camel.processor.interceptor.TraceFormatter.format(TraceFormatter.java:54)
        at org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:97)
        at org.apache.camel.processor.Logger.logMessage(Logger.java:234)
        at org.apache.camel.processor.Logger.process(Logger.java:125)
        at org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:122)
        at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:80)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:55)
        at org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:54)
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:55)
        at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:50)
        at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:79)
        at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:84)
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:64)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
        at org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:109)
        at org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:81)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:631)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:585)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:480)
        at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:349)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

The code in TraceFormatter.java looks like this:

    protected Object getBreadCrumbID(Exchange exchange) {
        UnitOfWork unitOfWork = exchange.getUnitOfWork();
        return unitOfWork.getId();
    }

But there is code in UnitOfWorkProcessor.process() which seems to indicate that exchange.getUnitOfWork()
will sometimes return null. This method begins by saying

        if (exchange.getUnitOfWork() == null) {
            // If there is no existing UoW, then we should start one and
            // terminate it once processing is completed for the exchange.

Would it be possible to enhance TraceFormatter to simply check for this?  I'm going to try

    protected Object getBreadCrumbID(Exchange exchange) {
        UnitOfWork unitOfWork = exchange.getUnitOfWork();
        if (unitOfWork != null) {
            return unitOfWork.getId();
        } else {
           return "[unknown UOW]";
        }
    }

If this doesn't work, I'll follow up with a message here.

> NPE in TraceFormatter
> ---------------------
>
>                 Key: CAMEL-993
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-993
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.5.0
>            Reporter: Vadim Chekan
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 1.5.0
>
>
> This configuration causes NPE:
> {code}
> 		from("timer://kickoff_5?period=10000").
> 		setHeader("a").constant("aa").setBody().constant("a b c a_1 b_1").
> 		splitter(body().tokenize(" ")).
> 		setHeader("aggreagation_header").body().
> 		aggregator(header("aggreagation_header")).
> 		to("mock:out");
> {code}
> {code}
> 2008-10-17 07:47:11,321 [ Polling Thread] DEBUG DefaultAggregationCollection   - put
exchange:Exchange[Message: null] for key:null
> 2008-10-17 07:47:12,237 [ Polling Thread] ERROR Aggregator                     - 
> java.lang.NullPointerException
> 	at org.apache.camel.processor.interceptor.TraceFormatter.getBreadCrumbID(TraceFormatter.java:150)
> 	at org.apache.camel.processor.interceptor.TraceFormatter.format(TraceFormatter.java:45)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:94)
> 	at org.apache.camel.processor.Logger.logMessage(Logger.java:219)
> 	at org.apache.camel.processor.Logger.process(Logger.java:124)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:119)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:87)
> 	at org.apache.camel.processor.BatchProcessor.processExchange(BatchProcessor.java:190)
> 	at org.apache.camel.processor.BatchProcessor.processBatch(BatchProcessor.java:168)
> 	at org.apache.camel.processor.BatchProcessor.run(BatchProcessor.java:68)
> 	at java.lang.Thread.run(Thread.java:619)
> {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