spring-cloud-task
spring-cloud-task copied to clipboard
Taskexecution, int versus Integer - getExitCode should return int
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.
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.
This issue was resolved here: https://github.com/spring-cloud/spring-cloud-task/commit/3b252680e75caa5cb4b92aa2869e584e6e2b995d