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

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


The following commit(s) were added to refs/heads/master by this push:
     new b9adf54  CAMEL-15117: camel-salesforce - prevent NPE during stop 
(#3867)
b9adf54 is described below

commit b9adf54d075a30240b71f577110d34b13ddf76b8
Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com>
AuthorDate: Thu May 28 12:36:37 2020 +0200

    CAMEL-15117: camel-salesforce - prevent NPE during stop (#3867)
---
 .../salesforce/internal/streaming/SubscriptionHelper.java      | 10 ++++++++--
 1 file changed, 8 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 d6e288e..711c1dd 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
@@ -332,6 +332,7 @@ public class SubscriptionHelper extends ServiceSupport {
         }
 
         client = null;
+        LOG.debug("Stopped the helper and destroyed the client");
     }
 
     static BayeuxClient createClient(final SalesforceComponent component) 
throws SalesforceException {
@@ -442,7 +443,7 @@ public class SubscriptionHelper extends ServiceSupport {
                             }
                         }
 
-                        if (abort) {
+                        if (abort && client != null) {
                             consumer.handleException(msg, new 
SalesforceException(msg, failure));
                         }
                     } else {
@@ -455,7 +456,12 @@ public class SubscriptionHelper extends ServiceSupport {
                     }
 
                     // remove this subscription listener
-                    client.getChannel(META_SUBSCRIBE).removeListener(this);
+                    if (client != null) {
+                        client.getChannel(META_SUBSCRIBE).removeListener(this);
+                    } else {
+                        LOG.warn("Trying to handle a subscription message but 
the client is already destroyed");
+                    }
+
                 }
             }
         };

Reply via email to