Commit d8ae6da7 authored by amir.yosef's avatar amir.yosef

handling unknown commands

parent c9425153
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public class SetCommand implements CommandHandler { public class SetCommand implements CommandHandler {
private final Storage storage = Storage.getInstance(); private final Storage storage = Storage.getInstance();
private final List<String>args; private final List<String> args;
public SetCommand(List<String> args) { public SetCommand(List<String> args) {
this.args = args; this.args = args;
......
...@@ -21,7 +21,8 @@ public enum Command { ...@@ -21,7 +21,8 @@ public enum Command {
WAIT("WAIT"), WAIT("WAIT"),
XADD("XADD"), XADD("XADD"),
XRANGE("XRANGE"), XRANGE("XRANGE"),
XREAD("XREAD"), MULTI("MULTI"), EXEC("EXEC"), DISCARD("DISCARD"); XREAD("XREAD"), MULTI("MULTI"), EXEC("EXEC"), DISCARD("DISCARD"),
UNKNOWN("UNKNOWN");
private final String value; private final String value;
......
...@@ -42,6 +42,6 @@ public class CommandUtil { ...@@ -42,6 +42,6 @@ public class CommandUtil {
return Command.EXEC; return Command.EXEC;
} else if (command.toLowerCase().contains(Command.DISCARD.getValue()) || command.equalsIgnoreCase(Command.DISCARD.getValue())) { } else if (command.toLowerCase().contains(Command.DISCARD.getValue()) || command.equalsIgnoreCase(Command.DISCARD.getValue())) {
return Command.DISCARD; return Command.DISCARD;
} else return null; } else return Command.UNKNOWN;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment