incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [06/45] git commit: Refactoring command lookup.
Date Sun, 26 Oct 2014 17:55:04 GMT
Refactoring command lookup.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/1b5f31c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/1b5f31c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/1b5f31c1

Branch: refs/heads/blur-384-random-port-cleanup
Commit: 1b5f31c133d8b38ac35c1c2f6258a819befe9d89
Parents: ac9b75f
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Sep 30 08:34:12 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Sep 30 08:34:12 2014 -0400

----------------------------------------------------------------------
 .../org/apache/blur/command/BaseCommandManager.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1b5f31c1/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index 436f641..a2d6aee 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -120,7 +120,7 @@ public class BaseCommandManager implements Closeable {
 
   @SuppressWarnings("unchecked")
   protected Map<String, String> getArguments(String commandName, boolean optional)
{
-    Command<?> command = _command.get(commandName);
+    Command<?> command = getCommandObject(commandName);
     if (command == null) {
       return null;
     }
@@ -380,7 +380,11 @@ public class BaseCommandManager implements Closeable {
   }
 
   protected Command<?> getCommandObject(String commandName) {
-    return _command.get(commandName);
+    Command<?> command = _command.get(commandName);
+    if (command == null) {
+      return null;
+    }
+    return command.clone();
   }
 
   protected String getCommandName(Class<? extends Command<?>> clazz) {
@@ -445,7 +449,7 @@ public class BaseCommandManager implements Closeable {
 
   @SuppressWarnings("unchecked")
   public String getDescription(String commandName) {
-    Command<?> command = _command.get(commandName);
+    Command<?> command = getCommandObject(commandName);
     if (command == null) {
       return null;
     }
@@ -458,7 +462,7 @@ public class BaseCommandManager implements Closeable {
   }
 
   public String getReturnType(String commandName) {
-    Command<?> command = _command.get(commandName);
+    Command<?> command = getCommandObject(commandName);
     if (command == null) {
       return null;
     }


Mime
View raw message