Author: mbautin
Date: Tue Feb 28 00:41:55 2012
New Revision: 1294423

URL: http://svn.apache.org/viewvc?rev=1294423&view=rev
Log:
[jira] [HBASE-5442] Follow-up: fix NPE in StoreFile

Summary: This probably sneaked in during rebasing somehow, because I did not
catch this in my testing. If we pass null as data block encoder to a StoreFile
writer builder, we still want to use a "no-op" data block encoder. This fixes
the following unit tests: TestStore TestStoreFile TestFSErrorsExposed
TestCompoundBloomFilter TestHLog

Test Plan: Run unit tests

Reviewers: liyintang

Reviewed By: liyintang

Differential Revision: https://reviews.facebook.net/D1983

Modified:
    
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java

Modified: 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
URL: 
http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java?rev=1294423&r1=1294422&r2=1294423&view=diff
==============================================================================
--- 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
 (original)
+++ 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
 Tue Feb 28 00:41:55 2012
@@ -710,6 +710,10 @@ public class StoreFile extends SchemaCon
         bloomType = BloomType.NONE;
       }
 
+      if (dataBlockEncoder == null) {
+        dataBlockEncoder = NoOpDataBlockEncoder.INSTANCE;
+      }
+
       return new Writer(this);
     }
   }
@@ -820,8 +824,7 @@ public class StoreFile extends SchemaCon
 
     private Writer(WriterBuilder wb)
         throws IOException {
-      this.dataBlockEncoder = wb.dataBlockEncoder != null ?
-          wb.dataBlockEncoder : NoOpDataBlockEncoder.INSTANCE;
+      this.dataBlockEncoder = wb.dataBlockEncoder;
       writer = HFile.getWriterFactory(wb.conf, wb.cacheConf)
           .withPath(wb.fs, wb.filePath)
           .withBlockSize(wb.blockSize)


Reply via email to