Skip to content

Commit

Permalink
HDFS-11827. NPE is thrown when log level changed in BlockPlacementPol…
Browse files Browse the repository at this point in the history
…icyDefault#chooseRandom() method. Contributed by xupeng.
  • Loading branch information
arp7 committed May 17, 2017
1 parent 18c494a commit ec21ce4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ protected DatanodeStorageInfo chooseRandom(int numOfReplicas,
}
Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode "
+ chosenNode + " is already in excludedNodes " + excludedNodes);
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled() && builder != null) {
builder.append("\nNode ").append(NodeBase.getPath(chosenNode))
.append(" [");
}
Expand Down Expand Up @@ -771,7 +771,7 @@ protected DatanodeStorageInfo chooseRandom(int numOfReplicas,
}
}

if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled() && builder != null) {
builder.append("\n]");
}

Expand Down

0 comments on commit ec21ce4

Please sign in to comment.