[
https://issues.apache.org/jira/browse/CAMEL-14113?focusedWorklogId=336654&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-336654
]
ASF GitHub Bot logged work on CAMEL-14113:
------------------------------------------
Author: ASF GitHub Bot
Created on: 31/Oct/19 08:31
Start Date: 31/Oct/19 08:31
Worklog Time Spent: 10m
Work Description: JiriOndrusek commented on pull request #3300:
[CAMEL-14113] camel-elasticsearch-rest: NullPointer exception if ther…
URL: https://github.com/apache/camel/pull/3300
…e is no body in exchange
Issue: https://issues.apache.org/jira/browse/CAMEL-14113
NPE was thrown when body of exchange didn't contain mandatory data. This PR
changes behavior in the way, that IllegalArgumentException with explanation is
thrown instead.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 336654)
Remaining Estimate: 0h
Time Spent: 10m
> 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
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Try simple route like this:
> {quote}from("timer:foo?period=5000&repeatCount=1")
> .log(">>> ${body}")
>
> .to("elasticsearch-rest://docker-cluster?operation=INDEX&indexName=twitter&hostAddresses=127.0.0.1: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)