From 10ed3f41f5c19f996a33dd606950e647aebda7c6 Mon Sep 17 00:00:00 2001 From: "michael.jin" Date: Thu, 29 Mar 2018 07:06:10 +0800 Subject: [PATCH] HBASE-20295 fix NullPointException in TableOutputFormat.checkOutputSpecs --- .../apache/hadoop/hbase/mapreduce/TableOutputFormat.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 7598520a481..0a1928b21f3 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());