You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "alberto.zigoni" <al...@gmail.com> on 2011/07/04 11:26:13 UTC

camel-cache: NPE for operations not requiring key

I am using Camel 2.6.0 with the camel-cache component.

I have noticed that Camel is throwing a NullPointerException if a message is
sent to a camel-cache endpoint, having body set to null.

This makes sense for operations such as ADD, where the input message body is
used as a value, but not really for operations such as DELETE_ALL or GET,
where the input message body is not used. In these cases, a setBody must be
forced to avoid NPEs being thrown by the camel-cache component.

Is this behaviour by design or should it be considered a bug?

Thanks

Alberto

--
View this message in context: http://camel.465427.n5.nabble.com/camel-cache-NPE-for-operations-not-requiring-key-tp4549468p4549468.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cache: NPE for operations not requiring key

Posted by "alberto.zigoni" <al...@gmail.com>.
@Willem:

version 2.7.2 solves the problem.

@Ashwin: this is the stacktrace I get using 2.6.0:

[efaultQuartzScheduler_Worker-1] DefaultErrorHandler            ERROR Failed
delivery for exchangeId: ID-localhost-64937-1309854451521-0-2. Exhausted
after delivery attempt: 1 caught:
org.apache.camel.NoTypeConversionAvailableException: No type converter
available to convert from type: null to the required type:
java.io.InputStream with value null
org.apache.camel.NoTypeConversionAvailableException: No type converter
available to convert from type: null to the required type:
java.io.InputStream with value null
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:126)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.component.cache.CacheProducer.performCacheOperation(CacheProducer.java:105)[camel-cache-2.6.0.jar:2.6.0]
	at
org.apache.camel.component.cache.CacheProducer.process(CacheProducer.java:95)[camel-cache-2.6.0.jar:2.6.0]
	at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:125)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:132)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:125)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:44)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:71)[camel-core-2.6.0.jar:2.6.0]
	at
org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:114)[camel-quartz-2.6.0.jar:2.6.0]
	at
org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.6.0.jar:2.6.0]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.4.jar:]
	at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.4.jar:]

This is the route definition (setBody is commented to raise the exception):

<route id="terminalsConfiguration">
			<from uri="direct:startTerminalsConfiguration" />
			
			<setHeader headerName="CACHE_OPERATION">
				<constant>DELETEALL</constant>
			</setHeader>
			
			
			<log message="Deleting all existing cache entries" />
			<to
uri="cache://credentialsCache?eternal=true&amp;timeToLiveSeconds=0&amp;timeToIdleSeconds=0"
/>
...

Alberto

--
View this message in context: http://camel.465427.n5.nabble.com/camel-cache-NPE-for-operations-not-requiring-key-tp4549468p4552540.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cache: NPE for operations not requiring key

Posted by Willem Jiang <wi...@gmail.com>.
CAMEL-3771[1] Fixed this issue, can you try to use the latest released 
Camel 2.7.2 ?

[1]https://issues.apache.org/jira/browse/CAMEL-3771

On 7/4/11 5:26 PM, alberto.zigoni wrote:
> I am using Camel 2.6.0 with the camel-cache component.
>
> I have noticed that Camel is throwing a NullPointerException if a message is
> sent to a camel-cache endpoint, having body set to null.
>
> This makes sense for operations such as ADD, where the input message body is
> used as a value, but not really for operations such as DELETE_ALL or GET,
> where the input message body is not used. In these cases, a setBody must be
> forced to avoid NPEs being thrown by the camel-cache component.
>
> Is this behaviour by design or should it be considered a bug?
>
> Thanks
>
> Alberto
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-cache-NPE-for-operations-not-requiring-key-tp4549468p4549468.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: camel-cache: NPE for operations not requiring message body

Posted by "alberto.zigoni" <al...@gmail.com>.
Subject was wrong, sorry.

--
View this message in context: http://camel.465427.n5.nabble.com/camel-cache-NPE-for-operations-not-requiring-key-tp4549468p4550069.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-cache: NPE for operations not requiring key

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Can you please provide the stack trace for the NPE that you are seeing. It
seems like a bug, however it is hard to tell without the stack trace.

Also can you provide a note on how this may be reproduced...

Thanks and Regards,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/camel-cache-NPE-for-operations-not-requiring-key-tp4549468p4551036.html
Sent from the Camel - Users mailing list archive at Nabble.com.