Repository: hbase
Updated Branches:
  refs/heads/branch-2 2cfa344ab -> 10ed3f41f


HBASE-20295 fix NullPointException in TableOutputFormat.checkOutputSpecs


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/10ed3f41
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/10ed3f41
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/10ed3f41

Branch: refs/heads/branch-2
Commit: 10ed3f41f5c19f996a33dd606950e647aebda7c6
Parents: 2cfa344
Author: michael.jin <michael....@zoom.us>
Authored: Thu Mar 29 07:06:10 2018 +0800
Committer: Michael Stack <st...@apache.org>
Committed: Sat Apr 7 09:30:52 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/10ed3f41/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
----------------------------------------------------------------------
diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
index 7598520..0a1928b 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
@@ -174,9 +174,13 @@ implements Configurable {
   @Override
   public void checkOutputSpecs(JobContext context) throws IOException,
       InterruptedException {
+    Configuration hConf = context.getConfiguration();
+    if(hConf == null) {
+      hConf = this.conf;
+    }
 
-    try (Admin admin = 
ConnectionFactory.createConnection(getConf()).getAdmin()) {
-      TableName tableName = TableName.valueOf(this.conf.get(OUTPUT_TABLE));
+    try (Admin admin = ConnectionFactory.createConnection(hConf).getAdmin()) {
+      TableName tableName = TableName.valueOf(hConf.get(OUTPUT_TABLE));
       if (!admin.tableExists(tableName)) {
         throw new TableNotFoundException("Can't write, table does not exist:" +
             tableName.getNameAsString());

Reply via email to