Commit 550d8911 authored by amir.yosef's avatar amir.yosef

Updating SET command args checking

parent 30c1e7c6
...@@ -31,12 +31,8 @@ public class SetCommand implements CommandExecutable<byte[]> { ...@@ -31,12 +31,8 @@ public class SetCommand implements CommandExecutable<byte[]> {
String value = args.get(1); String value = args.get(1);
String expiration = commandsMap.get(Command.PX.getValue().toLowerCase()); String expiration = commandsMap.get(Command.PX.getValue().toLowerCase());
if (expiration != null) { if (expiration != null) {
try { Long expirationTime = Long.parseLong(expiration);
Long expirationTime = Long.parseLong(expiration); storage.save(args.getFirst().toLowerCase(), value, expirationTime);
storage.save(args.getFirst().toLowerCase(), value, expirationTime);
} catch (NumberFormatException e) {
System.out.println("NumberFormatException: " + e.getMessage());
}
} else { } else {
storage.save(args.getFirst().toLowerCase(), value); storage.save(args.getFirst().toLowerCase(), value);
} }
......
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