Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14113

camel-elasticsearch-rest: NullPointer exception if there is no body in exchange

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.0
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Try simple route like this:

      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");

      and then observe exception in log:

      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)

      It would be much better, if error message with explanation is logged instead of NPE .

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jondruse Jiri Ondrusek
                Reporter:
                jondruse Jiri Ondrusek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m