Bug 768 - Failed to load update coupon page in the admin panel
Summary: Failed to load update coupon page in the admin panel
Status: RESOLVED FIXED
Alias: None
Product: CS3343 Salon Booking System
Classification: Unclassified
Component: admin.coupons.Update (show other bugs)
Version: 2.0
Hardware: PC Mac OS
: --- major
Assignee: kwanng9@my.cityu.edu.hk
URL:
Depends on:
Blocks:
 
Reported: 2023-11-04 18:40 HKT by shukhyiu2-c
Modified: 2023-11-17 12:23 HKT (History)
3 users (show)

See Also:


Attachments
UI of update coupon page (91.36 KB, image/png)
2023-11-04 18:40 HKT, shukhyiu2-c
Details
Screenshot for prove of problem solved (604.75 KB, image/jpeg)
2023-11-17 12:23 HKT, Samuel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shukhyiu2-c 2023-11-04 18:40:59 HKT
Created attachment 145 [details]
UI of update coupon page

Description: 
Overview: 
When trying to update a coupon in the admin panel, coupon information and input fields are not shown on UI.

Steps to Reproduce: 
1. login as admin
2. select "Manage Coupons"
3. click a existing coupon in the list

Actual Results: 
The UI does not show the original information and input fields of the selected coupon The UI can be seen in the attached screenshot (Attachment: admin_coupons_Update_202311041830.png). Also, the following error is shown in the console:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at admin.coupons.Update.<init>(Update.java:67)
	at admin.coupons.Read$3.mouseClicked(Read.java:81)
	at java.desktop/java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:278)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6629)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4584)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Expected Results: 
The system should show the original information and input fields of the selected coupon.

Build Date & Hardware: 
Build 2023-11-04 on Mac OS 13.1
Comment 1 chtsang246-c 2023-11-07 10:26:05 HKT
Already fixed in the latest version of the code. The issue was caused by the wrong parameter passed to the Update method in the Read.java file in admin.coupons package.
The code was revised as follows:
MouseAdapter mouseAdapter = new MouseAdapter() 
{
    @Override
    public void mouseClicked(MouseEvent e) 
    {
        int row = table.getTable().getSelectedRow();
        frame.get().dispose();
        new Update(tableDataRaw.get(row).split(", ")[0], tableDataRaw.get(row));
    }
};
Comment 2 Samuel 2023-11-17 12:23:25 HKT
Created attachment 150 [details]
Screenshot for prove of problem solved

Here is the testing result after correcting the problematic SQL query sentence