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

handling unknown commands

parent c9425153
......@@ -11,7 +11,7 @@ import java.util.Map;
public class SetCommand implements CommandHandler {
private final Storage storage = Storage.getInstance();
private final List<String>args;
private final List<String> args;
public SetCommand(List<String> args) {
this.args = args;
......
......@@ -21,7 +21,8 @@ public enum Command {
WAIT("WAIT"),
XADD("XADD"),
XRANGE("XRANGE"),
XREAD("XREAD"), MULTI("MULTI"), EXEC("EXEC"), DISCARD("DISCARD");
XREAD("XREAD"), MULTI("MULTI"), EXEC("EXEC"), DISCARD("DISCARD"),
UNKNOWN("UNKNOWN");
private final String value;
......
......@@ -42,6 +42,6 @@ public class CommandUtil {
return Command.EXEC;
} else if (command.toLowerCase().contains(Command.DISCARD.getValue()) || command.equalsIgnoreCase(Command.DISCARD.getValue())) {
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