Repository: camel
Updated Branches:
  refs/heads/master 2e1a11491 -> 574091dd9


CAMEL-11386 Potential NullPointerException if H...

...TTP client not started and stop was performed

This adds `null` check of `inflightRequests` to the `stop` method.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/574091dd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/574091dd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/574091dd

Branch: refs/heads/master
Commit: 574091dd92957bad5bd93a9d9e19257ee047f22e
Parents: 2e1a114
Author: Zoran Regvart <zregv...@apache.org>
Authored: Thu Jun 8 15:02:54 2017 +0200
Committer: Zoran Regvart <zregv...@apache.org>
Committed: Thu Jun 8 15:02:54 2017 +0200

----------------------------------------------------------------------
 .../internal/client/AbstractClientBase.java           | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/574091dd/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java
----------------------------------------------------------------------
diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java
 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java
index 26a86d9..e996de5 100644
--- 
a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java
@@ -103,12 +103,14 @@ public abstract class AbstractClientBase implements 
SalesforceSession.Salesforce
 
     @Override
     public void stop() throws Exception {
-        inflightRequests.arrive();
-        if (!inflightRequests.isTerminated()) {
-            try {
-                inflightRequests.awaitAdvanceInterruptibly(0, 
terminationTimeout, TimeUnit.SECONDS);
-            } catch (InterruptedException | TimeoutException ignored) {
-                // exception is ignored
+        if (inflightRequests != null) {
+            inflightRequests.arrive();
+            if (!inflightRequests.isTerminated()) {
+                try {
+                    inflightRequests.awaitAdvanceInterruptibly(0, 
terminationTimeout, TimeUnit.SECONDS);
+                } catch (InterruptedException | TimeoutException ignored) {
+                    // exception is ignored
+                }
             }
         }
 

Reply via email to