ACCUMULO-2248 properly catch wrapped NamespaceNotFoundException in concurrent
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ae201400 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ae201400 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ae201400 Branch: refs/heads/master Commit: ae20140036aad8dd68f0973ca69b346b25288042 Parents: da906f0 Author: John Vines <vi...@apache.org> Authored: Mon Feb 3 19:08:57 2014 -0500 Committer: John Vines <vi...@apache.org> Committed: Mon Feb 3 19:08:57 2014 -0500 ---------------------------------------------------------------------- .../test/randomwalk/concurrent/CloneTable.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ae201400/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java index f45c610..7802385 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java @@ -22,27 +22,29 @@ import java.util.List; import java.util.Properties; import java.util.Random; +import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; public class CloneTable extends Test { - + @Override public void visit(State state, Properties props) throws Exception { Connector conn = state.getConnector(); - + Random rand = (Random) state.get("rand"); - + @SuppressWarnings("unchecked") List<String> tableNames = (List<String>) state.get("tables"); - + String srcTableName = tableNames.get(rand.nextInt(tableNames.size())); String newTableName = tableNames.get(rand.nextInt(tableNames.size())); boolean flush = rand.nextBoolean(); - + try { log.debug("Cloning table " + srcTableName + " " + newTableName + " " + flush); conn.tableOperations().clone(srcTableName, newTableName, flush, new HashMap<String,String>(), new HashSet<String>()); @@ -52,6 +54,12 @@ public class CloneTable extends Test { log.debug("Clone " + srcTableName + " failed, doesnt exist"); } catch (IllegalArgumentException e) { log.debug("Clone: " + e.toString()); + } catch (AccumuloException e) { + Throwable cause = e.getCause(); + if (cause != null && cause instanceof NamespaceNotFoundException) + log.debug("Clone: " + srcTableName + " to " + newTableName + " failed, namespace not found"); + else + throw e; } } }