From 9aae7c22acfcc7b337cf06149864319d2cc877f8 Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Thu, 3 May 2012 19:05:38 +0000 Subject: [PATCH] HDFS-3332. NullPointerException in DN when directoryscanner is trying to report bad blocks. Contributed by Amith D K. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1333587 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java index f018f53e73..10049e8871 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java @@ -235,6 +235,9 @@ void scheduleBlockReport(long delay) { } void reportBadBlocks(ExtendedBlock block) { + if (bpRegistration == null) { + return; + } DatanodeInfo[] dnArr = { new DatanodeInfo(bpRegistration) }; LocatedBlock[] blocks = { new LocatedBlock(block, dnArr) };