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

davsclaus pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.0.x by this push:
     new 238e731813b CAMEL-20834: camel-salesforce - A NullPointException in 
SubscriptionHelper.subscribe() interrupts platform-event subscription (#14572)
238e731813b is described below

commit 238e731813b3245379c87937e882adc70d566966
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Jun 18 13:55:13 2024 +0200

    CAMEL-20834: camel-salesforce - A NullPointException in 
SubscriptionHelper.subscribe() interrupts platform-event subscription (#14572)
---
 .../salesforce/internal/streaming/SubscriptionHelper.java          | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java
 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java
index 4440f7eaf1a..6332007a7e1 100644
--- 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java
@@ -445,9 +445,12 @@ public class SubscriptionHelper extends ServiceSupport {
         final ClientSessionChannel.MessageListener subscriptionListener = new 
ClientSessionChannel.MessageListener() {
             public void onMessage(ClientSessionChannel channel, Message 
message) {
                 LOG.debug("[CHANNEL:META_SUBSCRIBE]: {}", message);
-                final String subscribedChannelName = 
message.get(SUBSCRIPTION_FIELD).toString();
+                final String subscribedChannelName = 
message.getOrDefault(SUBSCRIPTION_FIELD, "").toString();
+                if ("".equals(subscribedChannelName)) {
+                    LOG.warn("[CHANNEL:META_SUBSCRIBE]: No field {} found. 
Skipping message: {}", SUBSCRIPTION_FIELD, message);
+                    return;
+                }
                 if (channelName.equals(subscribedChannelName)) {
-
                     if (!message.isSuccessful()) {
                         String error = (String) message.get(ERROR_FIELD);
                         if (error == null) {

Reply via email to