mirror of
https://github.com/apache/sqoop.git
synced 2025-05-06 10:01:30 +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 = new ReadThread(process.getErrorStream());
|
||||||
thread.start();
|
thread.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LOG.error("Can't start up pg_bulkload process", e);
|
||||||
cleanup(context);
|
cleanup(context);
|
||||||
doExecuteUpdate("DROP TABLE " + tmpTableName);
|
doExecuteUpdate("DROP TABLE " + tmpTableName);
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
@ -200,10 +201,17 @@ protected void cleanup(Context context)
|
|||||||
LongWritable taskid =
|
LongWritable taskid =
|
||||||
new LongWritable(context.getTaskAttemptID().getTaskID().getId());
|
new LongWritable(context.getTaskAttemptID().getTaskID().getId());
|
||||||
context.write(taskid, new Text(tmpTableName));
|
context.write(taskid, new Text(tmpTableName));
|
||||||
writer.close();
|
|
||||||
out.close();
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
if (out != null) {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
thread.join();
|
if (thread != null) {
|
||||||
|
thread.join();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// block until the process is done.
|
// block until the process is done.
|
||||||
if (null != process) {
|
if (null != process) {
|
||||||
|
Loading…
Reference in New Issue
Block a user