Bug 398 - Incorrect return cause by wrong inpuut date
Summary: Incorrect return cause by wrong inpuut date
Status: CONFIRMED
Alias: None
Product: Event Management System
Classification: Unclassified
Component: Backend (show other bugs)
Version: 1
Hardware: PC Windows
: --- enhancement
Assignee: mankitse3-c
URL:
Depends on:
Blocks:
 
Reported: 2020-11-10 22:57 HKT by mankitse3-c
Modified: 2020-11-11 17:59 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mankitse3-c 2020-11-10 22:57:00 HKT
When I input "1", it shows an error message.

=========================================================================
Welcome to the Event Management System
Please input today date (e.g. 01-jan-2020).
1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
	at EventManagementSystem.Day.set(Day.java:48)
	at EventManagementSystem.Day.<init>(Day.java:62)
	at EventManagementSystem.SystemDate.<init>(SystemDate.java:6)
	at EventManagementSystem.SystemDate.createTheInstance(SystemDate.java:11)
	at EventManagementSystem.Main.main(Main.java:17)
=========================================================================
Comment 1 mankitse3-c 2020-11-11 00:07:55 HKT
if (this.isValidDay(sDayParts[0]) && this.isValidMonth(sDayParts[1]) && this.isValidYear(sDayParts[2]) && sDayParts.length == 3 ) 

change to 

if (sDayParts.length == 3 && this.isValidDay(sDayParts[0]) && this.isValidMonth(sDayParts[1]) && this.isValidYear(sDayParts[2]) )