Skip to content

Commit

Permalink
Merge pull request #349 from PrinceCatt/master
Browse files Browse the repository at this point in the history
ban | in input
  • Loading branch information
yentheng0110 authored Nov 9, 2024
2 parents 49eb9f3 + 063452c commit 9dddc78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Empty file added logs/logs.log.lck
Empty file.
10 changes: 10 additions & 0 deletions src/main/java/bookbob/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@
import java.io.IOException;
import java.time.DateTimeException;
import java.time.format.DateTimeParseException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Parser {
private static final Logger logger = Logger.getLogger(Parser.class.getName());

private static final List<String> keywords = List.of("|");

public static void handleCommand(String input, CommandHandler commandHandler, Records records,
AppointmentRecord appointmentRecord) {
String[] inputArray = input.split(" ", 2);

boolean isBanned = keywords.stream().anyMatch(input::contains);
if (isBanned) {
System.out.println("You have entered a command containing illegal characters");
return;
}

String command = inputArray[0];

switch (command) {
Expand Down

0 comments on commit 9dddc78

Please sign in to comment.