This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch sal-npe in repository https://gitbox.apache.org/repos/asf/camel.git
commit e2d64b1481c41498f0e8e5ddbbb64a74f6b48cb0 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jun 18 12:28:39 2024 +0200 CAMEL-20834: camel-salesforce - A NullPointException in SubscriptionHelper.subscribe() interrupts platform-event subscription --- .../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 d0dd17aafdf..4cf48067b69 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 @@ -472,9 +472,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) {
