Repository: hbase
Updated Branches:
  refs/heads/branch-2.0 d396e4bc0 -> 57aaee5bb


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/57aaee5b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/57aaee5b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/57aaee5b

Branch: refs/heads/branch-2.0
Commit: 57aaee5bbb846e2679b857329d2cb2d91cd29827
Parents: d396e4b
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:23 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/57aaee5b/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