sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-1117: when failed to import a non-existing table, the failure information includes NullPointerException
Date Thu, 15 May 2014 21:34:54 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk a803f27dd -> 72e3bfdd6


SQOOP-1117: when failed to import a non-existing table, the failure information includes NullPointerException

(sam liu via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/72e3bfdd
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/72e3bfdd
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/72e3bfdd

Branch: refs/heads/trunk
Commit: 72e3bfdd6677f8630678d8aa94da7a8652692033
Parents: a803f27
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu May 15 14:33:24 2014 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu May 15 14:33:24 2014 -0700

----------------------------------------------------------------------
 src/java/org/apache/sqoop/orm/ClassWriter.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/72e3bfdd/src/java/org/apache/sqoop/orm/ClassWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/orm/ClassWriter.java b/src/java/org/apache/sqoop/orm/ClassWriter.java
index d680105..df1ab72 100644
--- a/src/java/org/apache/sqoop/orm/ClassWriter.java
+++ b/src/java/org/apache/sqoop/orm/ClassWriter.java
@@ -1118,6 +1118,13 @@ public class ClassWriter {
 
     String[] colNames = getColumnNames(columnTypes);
 
+    // Column number should be more than 0
+    if (colNames == null || colNames.length == 0) {
+      throw new IllegalArgumentException("There is no column found in the "
+              + "target table " + tableName
+              + ". Please ensure that your table name is correct.");
+    }
+
     // Translate all the column names into names that are safe to
     // use as identifiers.
     String [] cleanedColNames = cleanColNames(colNames);


Mime
View raw message