From ac5b0cba06723dd4c38f4d016190da5166040e76 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Wed, 14 Apr 2021 15:21:57 +0300 Subject: [PATCH] Fixed - ClusterConnectionManager.checkMasterNodesChange() throws NPE. #3541 --- .../org/redisson/cluster/ClusterConnectionManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java b/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java index 56b9bcde5..b518941cc 100644 --- a/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java +++ b/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java @@ -475,7 +475,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { Set lastPartitions = getLastPartitions(); for (ClusterPartition newPart : newPartitions) { for (ClusterPartition currentPart : lastPartitions) { - if (!newPart.getMasterAddress().equals(currentPart.getMasterAddress())) { + if (!Objects.equals(newPart.getMasterAddress(), currentPart.getMasterAddress())) { continue; } @@ -555,7 +555,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { for (ClusterPartition newPart : newPartitions) { boolean masterFound = false; for (ClusterPartition currentPart : lastPartitions) { - if (!newPart.getMasterAddress().equals(currentPart.getMasterAddress())) { + if (!Objects.equals(newPart.getMasterAddress(), currentPart.getMasterAddress())) { continue; } masterFound = true; @@ -566,7 +566,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { for (Integer slot : currentPart.getSlots()) { ClusterPartition newMasterPart = find(newPartitions, slot); // does partition has a new master? - if (!newMasterPart.getMasterAddress().equals(currentPart.getMasterAddress())) { + if (!Objects.equals(newMasterPart.getMasterAddress(), currentPart.getMasterAddress())) { RedisURI newUri = newMasterPart.getMasterAddress(); RedisURI oldUri = currentPart.getMasterAddress(); @@ -654,7 +654,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { Set changedSlots = new HashSet<>(); for (ClusterPartition currentPartition : getLastPartitions()) { for (ClusterPartition newPartition : newPartitions) { - if (!currentPartition.getNodeId().equals(newPartition.getNodeId())) { + if (!Objects.equals(currentPartition.getNodeId(), newPartition.getNodeId())) { continue; }