You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/08/02 11:28:11 UTC

[camel] 01/02: CAMEL-18333: camel-kafka - avoid NPE during health-check

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1fda680e1231d344f35cab27ad2d5af91f8fffbb
Author: Rinaldo Pitzer JĂșnior <16...@users.noreply.github.com>
AuthorDate: Mon Aug 1 15:07:06 2022 -0300

    CAMEL-18333: camel-kafka - avoid NPE during health-check
    
    The pollExceptionStrategy might be null if, for example, the
    KafkaConsumer has not been created due to an exception. In those cases,
    a NPE was being thrown during the health check.
---
 .../main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java
index 2dcaf162b4f..266bf7a8f11 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java
@@ -515,7 +515,8 @@ public class KafkaFetchRecords implements Runnable {
     }
 
     private boolean isRecoverable() {
-        return (pollExceptionStrategy.canContinue() || isReconnect()) && isKafkaConsumerRunnable();
+        return (pollExceptionStrategy != null && pollExceptionStrategy.canContinue() || isReconnect())
+                && isKafkaConsumerRunnable();
     }
 
     // concurrent access happens here