| Summary: | Java Null Exception when view the Application that is empty | ||
|---|---|---|---|
| Product: | 2021 CS3343 Hall Admission System | Reporter: | amble3232 |
| Component: | System Section | Assignee: | Azim <mohamazim2> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | chpang22-c, mohamazim2 |
| Priority: | Normal | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
|
Description
amble3232
2021-12-04 16:01:20 HKT
I just tried this test case, there is a null problem. I suspect the code forgot to take account of the null situation. The system shout just outputs empty if there is a null value. I will pass it to the developer to solve this error. Currently, the system did not check if there is a null value, it run “Display.runDisplay("View Application", findApplication(std).toString(), false);” directly. Therefore, such errors appear when passing the null to the display object.
To solve the null error, the null value will be converted into an empty string.
Solution:
===============
public void viewApplication(Student std) {
Application application = findApplication(std);
if(application != null) {
Display.runDisplay("View Application", findApplication(std).toString(), false);
}
else {
System.out.println("");
}
}
|