From ebe621c9368c21f40e5475cec60f2d6f45074db2 Mon Sep 17 00:00:00 2001 From: CEGLincoln Date: Wed, 18 Sep 2019 15:31:43 +0800 Subject: [PATCH] mg --- build.gradle | 5 +++++ src/main/java/duke/parser/Parser.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 683e487068..81a190b87d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java' id 'application' + id 'checkstyle' } group 'seedu.duke' @@ -17,4 +18,8 @@ application { run { standardInput = System.in +} + +checkstyle { + toolVersion = '8.23' } \ No newline at end of file diff --git a/src/main/java/duke/parser/Parser.java b/src/main/java/duke/parser/Parser.java index 1dcd52f3b2..3c5594fea4 100644 --- a/src/main/java/duke/parser/Parser.java +++ b/src/main/java/duke/parser/Parser.java @@ -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)