Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it correct for isNonDefaultExitStatus to return true when status is null? #4617

Open
dkswnkk opened this issue Jun 10, 2024 · 0 comments · May be fixed by #4625
Open

Is it correct for isNonDefaultExitStatus to return true when status is null? #4617

dkswnkk opened this issue Jun 10, 2024 · 0 comments · May be fixed by #4625
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug

Comments

@dkswnkk
Copy link

dkswnkk commented Jun 10, 2024

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.

@dkswnkk dkswnkk added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jun 10, 2024
@kariskan kariskan linked a pull request Jun 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant