added null check before trying to call containsKey (prevent NPE)

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

Branch: refs/heads/camel-2.18.x
Commit: 201aeb22f7a8eea16690028f2b0969a452ca6bec
Parents: ac002c8
Author: Michael Lück <michael.lu...@hm-ag.de>
Authored: Wed Oct 5 15:22:51 2016 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Tue Oct 11 09:59:25 2016 +0200

----------------------------------------------------------------------
 .../aggregate/hazelcast/HazelcastAggregationRepository.java       | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/201aeb22/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
 
b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
index 33185f0..9dd0c17 100644
--- 
a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
+++ 
b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepository.java
@@ -296,7 +296,10 @@ public class HazelcastAggregationRepository extends 
ServiceSupport
      * @param key Object - key in question
      */
     public boolean containsKey(Object key){
+      if(cache != null)
         return cache.containsKey(key);
+      else
+        return false;
     }
     
     public boolean isAllowSerializedHeaders() {

Reply via email to