Skip to content

Commit

Permalink
Merge pull request #200 from EugeneChanJiajun/master
Browse files Browse the repository at this point in the history
Bug fix and userguide update
  • Loading branch information
daryltay415 committed Apr 8, 2024
2 parents 5f68f0b + 4bc2e5a commit 318cad0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Expected outcome:

### Adding a general travel activity : `add`
Adds a general travel activity into the travel activity list
* This is for activities that do not fall under the other activity types. EG. visiting a country.

Format: `add DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`

Expand Down
17 changes: 15 additions & 2 deletions src/main/java/seedu/omnitravel/errorhandlers/CheckParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public static void addExceptions(String[] input, String commandType, String line
"/date YYYY-MM-DD /duration DURATION"
+ " or add DESCRIPTION /date YYYY-MM-DD /duration DURATION /tag TAG");
}


}

/**
Expand Down Expand Up @@ -152,4 +150,19 @@ public static void handleException(Exception exception) {
Ui.printInterruptedError();
}
}

/**
* Checks the input that the users placed into the chatbot and checks if the input contains any ASCII characters.
*
* @param input Input line that users placed into the chatbot
* @throws OmniException if the input contains any non-ASCII characters
*/
public static void asciiCheck(String input) throws OmniException {
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (c < 32 || c > 126) {
throw new OmniException("Input contains non-ASCII characters.");
}
}
}
}
1 change: 1 addition & 0 deletions src/main/java/seedu/omnitravel/omnitravel/OmniTravel.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static void main(String[] args) throws IOException {
try {
String line = in.nextLine();
assert line != null :"Input does not exist!";
CheckParameters.asciiCheck(line);
String[] command = line.split(" ");
logger.log(Level.INFO, command[0]);
switch (command[0].toLowerCase()) {
Expand Down

0 comments on commit 318cad0

Please sign in to comment.