Bug 531 - Error exists when increasing the infected location
Summary: Error exists when increasing the infected location
Status: CONFIRMED
Alias: None
Product: Group 15
Classification: Unclassified
Component: Coronavirus Tracker (show other bugs)
Version: 1.0
Hardware: PC Windows
: --- normal
Assignee: tcwong285-c
URL:
Depends on:
Blocks:
 
Reported: 2020-12-07 18:32 HKT by tcwong285-c
Modified: 2020-12-07 22:33 HKT (History)
1 user (show)

See Also:


Attachments
This is the error message occur when I want to input the patientID (22.55 KB, image/png)
2020-12-07 22:33 HKT, tcwong285-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tcwong285-c 2020-12-07 18:32:02 HKT
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)
Comment 1 tcwong285-c 2020-12-07 21:47:49 HKT
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.
Comment 2 tcwong285-c 2020-12-07 22:33:40 HKT
Created attachment 67 [details]
This is the error message occur when I want to input the patientID