You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jiri Ondrusek (Jira)" <ji...@apache.org> on 2019/10/30 08:33:00 UTC
[jira] [Updated] (CAMEL-14113) camel-elasticsearch-rest:
NullPointer exception if there is no body in exchange
[ https://issues.apache.org/jira/browse/CAMEL-14113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiri Ondrusek updated CAMEL-14113:
----------------------------------
Description:
Try simple route like this:
{quote}from("timer:foo?period=5000&repeatCount=1")
.log(">>> ${body}")
.to("elasticsearch-rest://docker-cluster?operation=INDEX&indexName=twitter&indexType=tweet&hostAddresses=127.0.0.1:9200")
//.to("elasticsearch-rest://docker-cluster?operation=Search&indexName=twitter&indexType=tweet&hostAddresses=172.17.0.2:9200")
.to("mock:result");
{quote}
and then observe exception in log:
{quote}08:59:19.181 [Camel (MyCamel) thread #1 - timer://foo] WARN o.a.c.component.timer.TimerConsumer - Error processing exchange. Exchange[ID-localhost-localdomain-1572422356875-0-1]. Caused by: [java.lang.NullPointerException - null]
java.lang.NullPointerException: null
at org.apache.camel.component.elasticsearch.converter.ElasticsearchActionRequestConverter.toIndexRequest(ElasticsearchActionRequestConverter.java:116)
at org.apache.camel.component.elasticsearch.ElasticsearchProducer.process(ElasticsearchProducer.java:161)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505){quote}
It would be much better, if error message with explanation is logged instead of NPE .
was:
Try simple route like this:
{quote}from("timer:foo?period=5000&repeatCount=1")
.log(">>> ${body}")
.to("elasticsearch-rest://docker-cluster?operation=INDEX&indexName=twitter&indexType=tweet&hostAddresses=127.0.0.1:9200")
//.to("elasticsearch-rest://docker-cluster?operation=Search&indexName=twitter&indexType=tweet&hostAddresses=172.17.0.2:9200")
.to("mock:result");
{quote}
and then observe exception in log:
{quote}08:59:19.181 [Camel (MyCamel) thread #1 - timer://foo] WARN o.a.c.component.timer.TimerConsumer - Error processing exchange. Exchange[ID-localhost-localdomain-1572422356875-0-1]. Caused by: [java.lang.NullPointerException - null]
java.lang.NullPointerException: null
at org.apache.camel.component.elasticsearch.converter.ElasticsearchActionRequestConverter.toIndexRequest(ElasticsearchActionRequestConverter.java:116)
at org.apache.camel.component.elasticsearch.ElasticsearchProducer.process(ElasticsearchProducer.java:161)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505){quote}
It would be much better, if instead of NPE error message with explanation is logged.
> camel-elasticsearch-rest: NullPointer exception if there is no body in exchange
> -------------------------------------------------------------------------------
>
> Key: CAMEL-14113
> URL: https://issues.apache.org/jira/browse/CAMEL-14113
> Project: Camel
> Issue Type: Bug
> Components: camel-elasticsearch-rest
> Affects Versions: 3.0.0
> Reporter: Jiri Ondrusek
> Assignee: Jiri Ondrusek
> Priority: Minor
>
> Try simple route like this:
> {quote}from("timer:foo?period=5000&repeatCount=1")
> .log(">>> ${body}")
> .to("elasticsearch-rest://docker-cluster?operation=INDEX&indexName=twitter&indexType=tweet&hostAddresses=127.0.0.1:9200")
> //.to("elasticsearch-rest://docker-cluster?operation=Search&indexName=twitter&indexType=tweet&hostAddresses=172.17.0.2:9200")
> .to("mock:result");
> {quote}
> and then observe exception in log:
> {quote}08:59:19.181 [Camel (MyCamel) thread #1 - timer://foo] WARN o.a.c.component.timer.TimerConsumer - Error processing exchange. Exchange[ID-localhost-localdomain-1572422356875-0-1]. Caused by: [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
> at org.apache.camel.component.elasticsearch.converter.ElasticsearchActionRequestConverter.toIndexRequest(ElasticsearchActionRequestConverter.java:116)
> at org.apache.camel.component.elasticsearch.ElasticsearchProducer.process(ElasticsearchProducer.java:161)
> at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
> at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
> at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
> at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
> at java.util.TimerThread.mainLoop(Timer.java:555)
> at java.util.TimerThread.run(Timer.java:505){quote}
> It would be much better, if error message with explanation is logged instead of NPE .
--
This message was sent by Atlassian Jira
(v8.3.4#803005)