From e111789aeb005c76e443c96418cd9fddf9bdb8a2 Mon Sep 17 00:00:00 2001 From: Sammi Chen Date: Fri, 2 Aug 2019 03:33:57 +0800 Subject: [PATCH] HDDS-1882. TestReplicationManager failed with NPE. (#1197) --- .../hadoop/hdds/scm/container/ReplicationManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java index 0557ea10d20..a8dff405e43 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java @@ -486,8 +486,11 @@ public class ReplicationManager { final List excludeList = replicas.stream() .map(ContainerReplica::getDatanodeDetails) .collect(Collectors.toList()); - inflightReplication.get(id).stream().map(r -> r.datanode) - .forEach(excludeList::add); + List actionList = inflightReplication.get(id); + if (actionList != null) { + actionList.stream().map(r -> r.datanode) + .forEach(excludeList::add); + } final List selectedDatanodes = containerPlacement .chooseDatanodes(excludeList, null, delta, container.getUsedBytes());