Bug 820 - Index out of bound when input value smaller than -1
Summary: Index out of bound when input value smaller than -1
Status: RESOLVED FIXED
Alias: None
Product: 2023 CS3343 Group 20 System
Classification: Unclassified
Component: UI (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Assignee: hfwong56-c
URL:
Depends on:
Blocks:
 
Reported: 2023-12-08 21:30 HKT by mhlee64-c
Modified: 2023-12-09 14:02 HKT (History)
0 users

See Also:


Attachments
Test case for index out of bound exception when input smaller than -1 (33.93 KB, image/png)
2023-12-08 21:30 HKT, mhlee64-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mhlee64-c 2023-12-08 21:30:01 HKT
Created attachment 166 [details]
Test case for index out of bound exception when input smaller than -1

Some functions in the system allow user to select multiple items before doing action to them, so that the user do not need to repeat a function to do actions on multiple items, the UI handle this interaction by using -1 as indicator to stop, however, if the user enter a value smaller than -1, exception occur.
--------------------------------------------------------------------------------
Welcome to CMS!
============================================== Login ===============================================
Please enter your staff ID: d
Please enter your password: d
============================================ Main Menu =============================================
Login as [Doctor] Dr. dummer dr one | d | 
0.	Patient Mangement
1.	Appointment Management
2.	MedRecord Management
3.	Medicine Management
4.	Admin
5.	Logoff
Please select a function: 2
======================================= MedRecord Management =======================================
0.	Diagnose & Prescribe
1.	Dispense
2.	Edit Prescription
Please select a function: 0
========================================== Select Patient ==========================================
Please input patient's HKID: a123456
[Patient] Dummy patient | M | a123456 | 2020-06-29 | 
============================================= Diagnose =============================================
Diagnosis content: 
flu
New diagnosis added successfully.
Prescribe? (Y/N): Y
======================================= Patient's Allergies ========================================
None
Enter any key to continue. 
========================================== Medicine List ===========================================
-1.	Enter -1 to finish.
0.	[Medicine] m1 | $:100.0/tab | Stock: 2
1.	[Medicine] m2 | $:100.0/10mg | Stock: 2
Please select the drugs: 0
Please select the drugs: -2
============================================== ERROR ===============================================
java.lang.IndexOutOfBoundsException: Index -2 out of bounds for length 2