ACCUMULO-3972 fix how setshelliter checks class can load

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

Branch: refs/heads/master
Commit: a1497d14afd205b5a365edca3ede4c11624c4f57
Parents: 562b6ad
Author: Keith Turner <ke...@deenlo.com>
Authored: Thu Aug 27 17:15:14 2015 -0400
Committer: Keith Turner <ke...@deenlo.com>
Committed: Thu Aug 27 17:15:14 2015 -0400

----------------------------------------------------------------------
 .../util/shell/commands/SetShellIterCommand.java     | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1497d14/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetShellIterCommand.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetShellIterCommand.java
 
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetShellIterCommand.java
index d5d2174..a06c412 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetShellIterCommand.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetShellIterCommand.java
@@ -54,19 +54,12 @@ public class SetShellIterCommand extends SetIterCommand {
 
     String profile = cl.getOptionValue(profileOpt.getOpt());
 
-    // instead of setting table properties, just put the options in a list to 
use at scan time
-    Class<?> loadClass;
-    try {
-      loadClass = getClass().getClassLoader().loadClass(classname);
-    } catch (ClassNotFoundException e) {
-      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, 
"Unable to load " + classname);
-    }
-    try {
-      loadClass.asSubclass(SortedKeyValueIterator.class);
-    } catch (ClassCastException ex) {
-      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, 
"xUnable to load " + classname + " as type " + 
SortedKeyValueIterator.class.getName());
+    if 
(!shellState.getConnector().instanceOperations().testClassLoad(classname, 
SortedKeyValueIterator.class.getName())) {
+      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, 
"Servers are unable to load " + classname + " as type "
+          + SortedKeyValueIterator.class.getName());
     }
 
+    // instead of setting table properties, just put the options in a list to 
use at scan time
     for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); 
i.hasNext();) {
       final Entry<String,String> entry = i.next();
       if (entry.getValue() == null || entry.getValue().isEmpty()) {

Reply via email to