Updated Branches: refs/heads/trunk 144d31e62 -> 0488503a3
SQOOP-855: pg_bulkload: NullPointerException will be thrown if user specified invalid path the binary (Jarek Jarcec Cecho via Cheolsoo Park) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/0488503a Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/0488503a Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/0488503a Branch: refs/heads/trunk Commit: 0488503a3a1af4fc7b7679e3f3457bf988c18701 Parents: 144d31e Author: Cheolsoo Park <[email protected]> Authored: Wed Jan 30 17:10:28 2013 -0800 Committer: Cheolsoo Park <[email protected]> Committed: Wed Jan 30 17:10:28 2013 -0800 ---------------------------------------------------------------------- .../sqoop/mapreduce/PGBulkloadExportMapper.java | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/0488503a/src/java/org/apache/sqoop/mapreduce/PGBulkloadExportMapper.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/sqoop/mapreduce/PGBulkloadExportMapper.java b/src/java/org/apache/sqoop/mapreduce/PGBulkloadExportMapper.java index 5ba2b6b..86c5e02 100644 --- a/src/java/org/apache/sqoop/mapreduce/PGBulkloadExportMapper.java +++ b/src/java/org/apache/sqoop/mapreduce/PGBulkloadExportMapper.java @@ -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)); - 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) {
