Skip to content

Commit

Permalink
Re-order sinceDate comparison checks in ArgsParser
Browse files Browse the repository at this point in the history
  • Loading branch information
nseah21 committed Dec 25, 2023
1 parent a1f0e17 commit b29e102
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/reposense/parser/ArgsParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b29e102

Please sign in to comment.