Skip to content

Commit

Permalink
ban | in input
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinceCatt committed Nov 9, 2024
1 parent 49eb9f3 commit 063452c
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 063452c

Please sign in to comment.