mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 00:30:00 +08:00
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:
parent
144d31e62a
commit
0488503a3a
@ -170,6 +170,7 @@ protected void setup(Context context)
|
||||
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 @@ protected void cleanup(Context context)
|
||||
LongWritable taskid =
|
||||
new LongWritable(context.getTaskAttemptID().getTaskID().getId());
|
||||
context.write(taskid, new Text(tmpTableName));
|
||||
writer.close();
|
||||
out.close();
|
||||
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
try {
|
||||
thread.join();
|
||||
if (thread != null) {
|
||||
thread.join();
|
||||
}
|
||||
} finally {
|
||||
// block until the process is done.
|
||||
if (null != process) {
|
||||
|
Loading…
Reference in New Issue
Block a user