5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-03 22:34:30 +08:00

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

(Mike Drob via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2014-07-17 07:52:39 -07:00
parent 92d363da65
commit 9aac957b9c

View File

@ -105,13 +105,22 @@ public static void addJars(Job job, SqoopOptions options) throws IOException {
.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);