sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: SQOOP-1370: AccumuloUtils can throw NPE when zookeeper or accumulo home is null
Date Thu, 17 Jul 2014 14:53:23 GMT
Repository: sqoop
Updated Branches:
  refs/heads/trunk 92d363da6 -> 9aac957b9


SQOOP-1370: AccumuloUtils can throw NPE when zookeeper or accumulo home is null

(Mike Drob 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/9aac957b
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/9aac957b
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/9aac957b

Branch: refs/heads/trunk
Commit: 9aac957b9c0e9f6c644df5cb529d5cd1a118dff8
Parents: 92d363d
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Thu Jul 17 07:52:39 2014 -0700
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Thu Jul 17 07:52:39 2014 -0700

----------------------------------------------------------------------
 .../org/apache/sqoop/accumulo/AccumuloUtil.java | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/9aac957b/src/java/org/apache/sqoop/accumulo/AccumuloUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/sqoop/accumulo/AccumuloUtil.java b/src/java/org/apache/sqoop/accumulo/AccumuloUtil.java
index 1cbb859..06888c5 100644
--- a/src/java/org/apache/sqoop/accumulo/AccumuloUtil.java
+++ b/src/java/org/apache/sqoop/accumulo/AccumuloUtil.java
@@ -105,13 +105,22 @@ public final class AccumuloUtil {
         .addAll(conf.getStringCollection(
           ConfigurationConstants.MAPRED_DISTCACHE_CONF_PARAM));
 
-      String dir = accumuloHome + File.separator + "lib";
-      LOG.info("Adding jar files under " + dir + " to distributed cache");
-      addDirToCache(new File(dir), fs, localUrls, false);
+      if (null == accumuloHome) {
+        throw new IllegalArgumentException("ACCUMULO_HOME is not set.");
+      } else {
+        File dir = new File(accumuloHome, "lib");
+        String path = dir.getPath();
+        LOG.info("Adding jar files under " + path + " to distributed cache");
+        addDirToCache(dir, fs, localUrls, false);
+      }
 
-      dir = zookeeperHome;
-      LOG.info("Adding jar files under " + dir + " to distributed cache");
-      addDirToCache(new File(dir), fs, localUrls, false);
+      if (null == zookeeperHome) {
+        throw new IllegalArgumentException("ZOOKEEPER_HOME is not set.");
+      } else {
+        String dir = zookeeperHome;
+        LOG.info("Adding jar files under " + dir + " to distributed cache");
+        addDirToCache(new File(dir), fs, localUrls, false);
+      }
 
       String tmpjars = conf
         .get(ConfigurationConstants.MAPRED_DISTCACHE_CONF_PARAM);


Mime
View raw message