HBASE-20295 fix NullPointException in TableOutputFormat.checkOutputSpecs
This commit is contained in:
parent
2cfa344ab1
commit
10ed3f41f5
|
@ -174,9 +174,13 @@ implements Configurable {
|
||||||
@Override
|
@Override
|
||||||
public void checkOutputSpecs(JobContext context) throws IOException,
|
public void checkOutputSpecs(JobContext context) throws IOException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
|
Configuration hConf = context.getConfiguration();
|
||||||
|
if(hConf == null) {
|
||||||
|
hConf = this.conf;
|
||||||
|
}
|
||||||
|
|
||||||
try (Admin admin = ConnectionFactory.createConnection(getConf()).getAdmin()) {
|
try (Admin admin = ConnectionFactory.createConnection(hConf).getAdmin()) {
|
||||||
TableName tableName = TableName.valueOf(this.conf.get(OUTPUT_TABLE));
|
TableName tableName = TableName.valueOf(hConf.get(OUTPUT_TABLE));
|
||||||
if (!admin.tableExists(tableName)) {
|
if (!admin.tableExists(tableName)) {
|
||||||
throw new TableNotFoundException("Can't write, table does not exist:" +
|
throw new TableNotFoundException("Can't write, table does not exist:" +
|
||||||
tableName.getNameAsString());
|
tableName.getNameAsString());
|
||||||
|
|
Loading…
Reference in New Issue