From b29e1024f7daa622ca67f3c26189ae7e8f1f9db4 Mon Sep 17 00:00:00 2001 From: nseah21 Date: Tue, 26 Dec 2023 07:40:51 +0800 Subject: [PATCH] Re-order sinceDate comparison checks in ArgsParser --- src/main/java/reposense/parser/ArgsParser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/reposense/parser/ArgsParser.java b/src/main/java/reposense/parser/ArgsParser.java index 60dacabd6c..ff6ea7ae95 100644 --- a/src/main/java/reposense/parser/ArgsParser.java +++ b/src/main/java/reposense/parser/ArgsParser.java @@ -424,14 +424,14 @@ private static void addAnalysisDatesToBuilder(CliArguments.Builder builder, Name ? untilDate : currentDate; - if (sinceDate.compareTo(untilDate) > 0) { - throw new ParseException(MESSAGE_SINCE_DATE_LATER_THAN_UNTIL_DATE); - } - if (sinceDate.compareTo(currentDate) > 0) { throw new ParseException(MESSAGE_SINCE_DATE_LATER_THAN_TODAY_DATE); } + if (sinceDate.compareTo(untilDate) > 0) { + throw new ParseException(MESSAGE_SINCE_DATE_LATER_THAN_UNTIL_DATE); + } + builder.sinceDate(sinceDate) .isSinceDateProvided(isSinceDateProvided) .untilDate(untilDate)