Skip to content

Commit

Permalink
mg
Browse files Browse the repository at this point in the history
  • Loading branch information
CEGLincoln committed Sep 18, 2019
1 parent 839ffc1 commit ebe621c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
}

group 'seedu.duke'
Expand All @@ -17,4 +18,8 @@ application {

run {
standardInput = System.in
}

checkstyle {
toolVersion = '8.23'
}
6 changes: 3 additions & 3 deletions src/main/java/duke/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ public static Command parse(String fullCommand) throws DukeException {
return new DoneCommand(taskNb - 1);
} else throw new DukeException("Need a task number after done!");
case "todo":
if ((splitted.length == 1) || splitted[1].isBlank())
if ((splitted.length == 1) || splitted[1].isEmpty())
throw new DukeException("The description of a todo cannot be empty.");
return new AddCommand(new Todo(splitted[1]));
case "deadline":
if ((splitted.length == 1) || splitted[1].isBlank())
if ((splitted.length == 1) || splitted[1].isEmpty())
throw new DukeException("The description of a deadline cannot be empty.");
String[] getBy = splitted[1].split("/by ", 2);
if (getBy.length < 2)
throw new DukeException("The description of a deadline must contain /by date!");
return new AddCommand(new Deadline(getBy[0], getBy[1]));
case "event":
if ((splitted.length == 1) || splitted[1].isBlank())
if ((splitted.length == 1) || splitted[1].isEmpty())
throw new DukeException("The description of an event cannot be empty, and it must contain /at");
String[] getAt = splitted[1].split("/at ", 2);
if (getAt.length < 2)
Expand Down

0 comments on commit ebe621c

Please sign in to comment.