HDFS-11827. NPE is thrown when log level changed in BlockPlacementPolicyDefault#chooseRandom() method. Contributed by xupeng.

This commit is contained in:
Arpit Agarwal 2017-05-16 19:51:04 -07:00 committed by Xiaoyu Yao
parent e774688409
commit 5ea7e16fa4
1 changed files with 2 additions and 2 deletions

View File

@ -735,7 +735,7 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
} }
Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode " Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode "
+ chosenNode + " is already in excludedNodes " + excludedNodes); + chosenNode + " is already in excludedNodes " + excludedNodes);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled() && builder != null) {
builder.append("\nNode ").append(NodeBase.getPath(chosenNode)) builder.append("\nNode ").append(NodeBase.getPath(chosenNode))
.append(" ["); .append(" [");
} }
@ -771,7 +771,7 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
} }
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled() && builder != null) {
builder.append("\n]"); builder.append("\n]");
} }