ACCUMULO-3216 Swap NPE for more informative error
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/18a3ef6b Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/18a3ef6b Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/18a3ef6b Branch: refs/heads/1.7 Commit: 18a3ef6b1b85c5b5043880f218567071950cc10b Parents: 8c0d881 Author: Christopher Tubbs <ctubb...@apache.org> Authored: Tue Jun 9 17:02:13 2015 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Tue Jun 9 17:02:13 2015 -0400 ---------------------------------------------------------------------- .../java/org/apache/accumulo/master/tableOps/ImportTable.java | 4 ++++ .../main/java/org/apache/accumulo/tserver/TabletServer.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/18a3ef6b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java ---------------------------------------------------------------------- diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java index 528a225..4bf6959 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java @@ -435,6 +435,10 @@ class CreateImportDir extends MasterRepo { log.info("Looking for matching filesystem for " + exportDir + " from options " + Arrays.toString(tableDirs)); Path base = master.getFileSystem().matchingFileSystem(exportDir, tableDirs); + if (base == null) { + throw new IOException(tableInfo.exportDir + " is not in a volume configured for Accumulo"); + } + log.info("Chose base table directory of " + base); Path directory = new Path(base, tableInfo.tableId); http://git-wip-us.apache.org/repos/asf/accumulo/blob/18a3ef6b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java ---------------------------------------------------------------------- diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java index 128aaa9..0446da3 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java @@ -294,7 +294,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu private static long jitter(long ms) { Random r = new Random(); // add a random 10% wait - return (long)((1. + (r.nextDouble() / 10)) * ms); + return (long) ((1. + (r.nextDouble() / 10)) * ms); } private synchronized static void logGCInfo(AccumuloConfiguration conf) { @@ -2538,6 +2538,10 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu Path source = new Path(filename); if (acuConf.getBoolean(Property.TSERV_ARCHIVE_WALOGS)) { Path walogArchive = fs.matchingFileSystem(source, ServerConstants.getWalogArchives()); + if (walogArchive == null) { + throw new IOException(filename + " is not in a volume configured for Accumulo"); + } + fs.mkdirs(walogArchive); Path dest = new Path(walogArchive, source.getName()); log.info("Archiving walog " + source + " to " + dest);