| Summary: | Java Object Null Exception when viewResult is run before the Function Process was run | ||
|---|---|---|---|
| Product: | 2021 CS3343 Hall Admission System | Reporter: | amble3232 |
| Component: | System Section | Assignee: | Azim <mohamazim2> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | chpang22-c |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
|
Description
amble3232
2021-12-04 16:12:04 HKT
The system should show “waiting for processing to finish” or “need to run process function”, instead of error of null. I will pass it to the developer to solve this error. As the set of process objects have not been created, so the system cannot output any result. But as the code is to run “Display.runDisplay("All Result", content, false);” and will not check if the process function has been run successfully. Therefore the ArrayList is null.
To solve the showing empty ArrayList problem, a check if the sets of process objects are created needed to be implemented.
Solution:
===============
public void viewResult() {
if(processApplication != null){
String content = processApplication.getFinalResult();
Display.runDisplay("All Result", content, false);
}
else {
String content = "Waiting for processing to finish.";
Display.runDisplay("All Result",content , false);
}
}
|