SQOOP-855: pg_bulkload: NullPointerException will be thrown if user specified invalid path the binary

(Jarek Jarcec Cecho via Cheolsoo Park)
This commit is contained in:
Cheolsoo Park 2013-01-30 17:10:28 -08:00
Родитель 144d31e62a
Коммит 0488503a3a
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -170,6 +170,7 @@ public class PGBulkloadExportMapper
thread = new ReadThread(process.getErrorStream());
thread.start();
} catch (Exception e) {
LOG.error("Can't start up pg_bulkload process", e);
cleanup(context);
doExecuteUpdate("DROP TABLE " + tmpTableName);
throw new IOException(e);
@ -200,10 +201,17 @@ public class PGBulkloadExportMapper
LongWritable taskid =
new LongWritable(context.getTaskAttemptID().getTaskID().getId());
context.write(taskid, new Text(tmpTableName));
if (writer != null) {
writer.close();
}
if (out != null) {
out.close();
}
try {
if (thread != null) {
thread.join();
}
} finally {
// block until the process is done.
if (null != process) {