Bug 638 - Java Null Exception when getting processed student information
Summary: Java Null Exception when getting processed student information
Status: RESOLVED FIXED
Alias: None
Product: 2021 CS3343 Hall Admission System
Classification: Unclassified
Component: Application Process Section (show other bugs)
Version: unspecified
Hardware: PC Windows
: Highest blocker
Assignee: Azim
URL:
Depends on:
Blocks:
 
Reported: 2021-12-04 15:40 HKT by amble3232
Modified: 2021-12-04 15:44 HKT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amble3232 2021-12-04 15:40:41 HKT
Background:
I am doing the unit test in ECLIPSE 2021-06 (4.20.0) on method findDetailResult() in StartProcessing class.
When I am doing testFindDetailResult() in testStartProcessing, I am testing the findDetailResult() to find the result of std1.

Steps to Reproduce:
1. Run the package with testHall_Admission
2. Run the method “void testFindDetailResult” in testStartProcessing class

Actual result:
The system output the error message of “java.lang.NullPointerException: Cannot invoke “HallAdmissionSystem.Application.equals(object)” because “this.admisionList[i] is null”” while the method was being run.

Expected result:
I expected the system to output the details of the object “std1”.
Comment 1 newbie 2021-12-04 15:41:22 HKT
I just tried to run this test, I also got the same error. I did briefly go through the code, I am not sure about the problems. It seems like involved the whole set of process objects. This may take time to fix.

I will pass it to the developer to solve this error.
Comment 2 Azim 2021-12-04 15:42:19 HKT
I just checked the problems, seem like the storage of object have problems. And the problem seems triggered chain reactions. Plus, the code is messy, it is hard for me to know which sections have problems as the applications object, hall and queue are stored all over the place. It made the code hard to read. I recommend we rewrite the whole process section.
Comment 3 newbie 2021-12-04 15:42:59 HKT
As now the progress is tight, redoing the major function may be risky and cause the project setback. Are you sure we are not able to maintain the current structure or code to solve the error? Is it a must to rewrite the whole section of the code?
Comment 4 Azim 2021-12-04 15:43:24 HKT
According to the current code, now have “StartProcess”, “ProcessData” and “Result”. Their role is unclear and the ArrayLists are all over the place. So when we carry out the process functions, the calling of object and data storage is unclear which made debugging and function expansion hard to carry out. So if we do it now, can help the current debugging and future functions expansions.
Comment 5 newbie 2021-12-04 15:44:00 HKT
Ok, understand the situation. I approve the rewrite of the Process Sections. Please finish this function rewrite as soon as possible.
Comment 6 Azim 2021-12-04 15:44:47 HKT
I just finished the update the code and uploaded it to GitHub. 

Solution:
===============
I have removed class “StartProcess”, “ProcessData” and “Result” and replaced them with “ProcessApplication”, “ProcessInformation” and “ProcessResult”. “ProcessApplication” will store all the initial applications, “ProcessInformation” will store all the process queue and “ProcessResult” will store the final result.