Commit 30c1e7c6 authored by amir.yosef's avatar amir.yosef

Updating handling wrong args ( SET & INFO & GET )

parent 7254798d
......@@ -18,7 +18,7 @@ public class GetCommand implements CommandExecutable<byte[]> {
@Override
public byte[] execute() {
if (!validator.validateGetCommand(args)) {
return "wrong args".getBytes();
return Response.getResponse("wrong args");
}
String response = storage.get(args.getFirst().toLowerCase());
if (response == null || response.isEmpty() || response.isBlank()) {
......
......@@ -20,7 +20,7 @@ public class InfoCommand implements CommandExecutable<byte[]> {
@Override
public byte[] execute() {
if (!validator.validateInfoCommand(args)) {
return "unsupported args".getBytes();
return Response.getResponse("unsupported args");
}
String command = args.getFirst();
if (command.equalsIgnoreCase(Command.REPLICATION.getValue())) {
......
......@@ -2,6 +2,7 @@ package command;
import model.Command;
import storage.Storage;
import util.Response;
import java.util.List;
import java.util.Map;
......@@ -20,7 +21,7 @@ public class SetCommand implements CommandExecutable<byte[]> {
@Override
public byte[] execute() {
if (!validator.validateSetCommand(args)) {
return "wrong args".getBytes();
return Response.getResponse("wrong args");
}
Map<String, String> commandsMap = IntStream.iterate(2, i -> i < args.size(), i -> i + 2)
......
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