Skip to content

Commit

Permalink
Merge pull request #214 from hongyijie06/master
Browse files Browse the repository at this point in the history
Merge branch 'master' of https://github.com/hongyijie06/tp
  • Loading branch information
hongyijie06 authored Apr 16, 2024
2 parents 6838e87 + a11224e commit 3cf419c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/seedu/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ private static void checkTimingValidity(String lowerCaseCommand) throws CustomEx
throw new CustomException(MESSAGE_INVALID_COMMAND_FORMAT);
}

String commandParameter = commandParts[THIRD_PARAMETER_INDEX];
boolean isCommandParameterOverflowing = isParamOverflowing(commandParameter);
if(isCommandParameterOverflowing) {
throw new CustomException(MESSAGE_EXCEPTION_CAUGHT + MESSAGE_PARAM_TOO_LONG);
}
try {
if (commandParts.length == TIMER_ONE_PARAMETER_LENGTH) {
int timeLimit = Integer.parseInt(commandParts[THIRD_PARAMETER_INDEX]);
Expand All @@ -243,6 +248,7 @@ private static void checkTimingValidity(String lowerCaseCommand) throws CustomEx
} catch (NumberFormatException e) {
throw new CustomException(MESSAGE_INVALID_PARAMETERS);
}

}

//@@author hongyijie06
Expand Down Expand Up @@ -726,7 +732,7 @@ public boolean checkFormat(String answer, Ui ui) {
}

//@@author yuhengr
private boolean isParamOverflowing(String param) {
private static boolean isParamOverflowing(String param) {
final int maxParamLength = 5;
int paramLength = param.length();

Expand Down

0 comments on commit 3cf419c

Please sign in to comment.