[ML] Fix NullPointerException when deleting a job with state "opening" (elastic/x-pack-elasticsearch#1769)
relates elastic/x-pack-elasticsearch#1768 Original commit: elastic/x-pack-elasticsearch@ae1f431316
This commit is contained in:
parent
c1685c70ea
commit
7ab6a7e83a
|
@ -365,8 +365,9 @@ public class MlMetadata implements MetaData.Custom {
|
|||
if (allowDeleteOpenJob == false) {
|
||||
PersistentTask<?> jobTask = getJobTask(jobId, tasks);
|
||||
if (jobTask != null) {
|
||||
JobTaskStatus jobTaskStatus = (JobTaskStatus) jobTask.getStatus();
|
||||
throw ExceptionsHelper.conflictStatusException("Cannot delete job [" + jobId + "] because the job is "
|
||||
+ ((JobTaskStatus) jobTask.getStatus()).getState());
|
||||
+ ((jobTaskStatus == null) ? JobState.OPENING : jobTaskStatus.getState()));
|
||||
}
|
||||
}
|
||||
Job.Builder jobBuilder = new Job.Builder(job);
|
||||
|
|
Loading…
Reference in New Issue