spring-cloud-task icon indicating copy to clipboard operation
spring-cloud-task copied to clipboard

Taskexecution, int versus Integer - getExitCode should return int

Open ghillert opened this issue 7 years ago • 1 comments
trafficstars

Class TaskExecution contains some ambiguous code:

public long getExecutionId() {
        return executionId;
    }

    public Integer getExitCode() {
        return (exitCode == null) ? 0 : exitCode;
    }

Personally, I favor object types but in case a method is never supposed to return null, long is an acceptable choice. In that case, though, getExitCode should return int and not Integer.

ghillert avatar Jun 13 '18 07:06 ghillert

This shouldn't have gotten this way. ExitCode is the value returned by the process at the end of the task execution. If the task hasn't ended, that should be null. Instead of changing the return type, we should remove that logic from the getter IMHO.

mminella avatar Jun 13 '18 13:06 mminella

This issue was resolved here: https://github.com/spring-cloud/spring-cloud-task/commit/3b252680e75caa5cb4b92aa2869e584e6e2b995d

cppwfs avatar Feb 16 '23 22:02 cppwfs