-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
I have a question regarding the behavior of the isNonDefaultExitStatus method in the ExitStatus class. According to the current implementation, the method returns true when the provided status is null. Here is the relevant code:
/**
* @param status The {@code ExitStatus} object containing the exit code to be evaluated.
* @return {@code true} if the value matches a known exit code.
*/
public static boolean isNonDefaultExitStatus(ExitStatus status) {
return status == null || status.getExitCode() == null
|| status.getExitCode().equals(ExitStatus.COMPLETED.getExitCode())
|| status.getExitCode().equals(ExitStatus.EXECUTING.getExitCode())
|| status.getExitCode().equals(ExitStatus.FAILED.getExitCode())
|| status.getExitCode().equals(ExitStatus.NOOP.getExitCode())
|| status.getExitCode().equals(ExitStatus.STOPPED.getExitCode())
|| status.getExitCode().equals(ExitStatus.UNKNOWN.getExitCode());
}
Based on the method's purpose, which is to determine if the given ExitStatus matches a known exit code, I am wondering if returning true when status is null is the intended behavior. Intuitively, it seems that null should not be considered as a known exit code, and thus, the method might be expected to return false in such cases.
I referred to the Spring Batch API documentation
Can you tell me if the intended behavior is for the method to return true when the input is null? If null is also a known exit code, I wonder if we could add something to the documentation about it.