When I want to increase the infected location, the following error exists and is not handled. Enter the infected PatientID that you want to add the location visited for: !@#!@##!@%#@%#@$@#$#@$@#$#@@@@@@@@@@@@@@$@#$#@$@#C#CECERCE java.lang.NumberFormatException: For input string: "!@#!@##!@%#@%#@$@#$#@$@#$#@@@@@@@@@@@@@@$@#$#@$@#C#CECERCE" Please enter command: ["c", "sn", "sp", "i", "slv", "cs", "d", "x", "undo", "redo"] c = create Patient, sn = show latest infection report, sp = show patient, i = increase location of infection spreading, slv = search different level of infection location, cs= change patient's health status, d = display undo/redo list, x = exit system, u = undo, r = redo at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) at java.base/java.lang.Integer.parseInt(Integer.java:638) at java.base/java.lang.Integer.parseInt(Integer.java:770) at InfectionTracker.Command.IncreaseLocationVisitedCommand.execute(IncreaseLocationVisitedCommand.java:36) at InfectionTracker.Object.Admin.showMenu(Admin.java:36) at InfectionTracker.Dataset.Account.showMenu(Account.java:43) at InfectionTracker.Main.main(Main.java:52)
I have handled this exception by adding a catch block to handle the NumberFormatException. Only valid location format and PatientID will be considered as input correctly. Those symbols '!@#$@#%^' will not be taken as a normal input.
Created attachment 67 [details] This is the error message occur when I want to input the patientID