From ea1d900129c238dcc16da7c29434ccd0787982cd Mon Sep 17 00:00:00 2001 From: zhuxt2015 <594754793@qq.com> Date: Thu, 17 Oct 2024 21:46:10 +0800 Subject: [PATCH] [BugFix]fix job id is null exception in query model (#3869) Co-authored-by: zhuxt2015 --- .../main/java/org/dinky/job/handler/Job2MysqlHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java b/dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java index a52f906d43..9694c50146 100644 --- a/dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java +++ b/dinky-admin/src/main/java/org/dinky/job/handler/Job2MysqlHandler.java @@ -180,17 +180,19 @@ public boolean success() { history.setClusterId(clusterId); historyService.updateById(history); - if (Asserts.isNullCollection(job.getJids()) || Asserts.isNullString(job.getJobManagerAddress())) { + if (job.getJobConfig().isStatementSet() + && (Asserts.isNullCollection(job.getJids()) || Asserts.isNullString(job.getJobManagerAddress()))) { throw new BusException("The JobID or JobManagerAddress is null. "); } - String jid = job.getJids().get(0); JobInstance jobInstance = history.buildJobInstance(); jobInstance.setHistoryId(job.getId()); jobInstance.setClusterId(clusterId); jobInstance.setTaskId(taskId); jobInstance.setName(job.getJobConfig().getJobName()); - jobInstance.setJid(jid); + if (Asserts.isNotNullCollection(job.getJids())) { + jobInstance.setJid(job.getJids().get(0)); + } jobInstance.setStep(job.getJobConfig().getStep()); jobInstance.setStatus(JobStatus.INITIALIZING.getValue()); jobInstanceService.save(jobInstance);