From 89ba78e96eb61ac341b38738d245f789e5cb5a74 Mon Sep 17 00:00:00 2001 From: zuo <58384836+xxzuo@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:41:05 +0800 Subject: [PATCH] [Fix][Server] Add check if the name has been changed when editing the job name (#234) --- .../server/repository/service/impl/JobServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datavines-server/src/main/java/io/datavines/server/repository/service/impl/JobServiceImpl.java b/datavines-server/src/main/java/io/datavines/server/repository/service/impl/JobServiceImpl.java index 92b020677..9e5419310 100644 --- a/datavines-server/src/main/java/io/datavines/server/repository/service/impl/JobServiceImpl.java +++ b/datavines-server/src/main/java/io/datavines/server/repository/service/impl/JobServiceImpl.java @@ -186,7 +186,7 @@ public long update(JobUpdate jobUpdate) { if (job == null) { throw new DataVinesServerException(Status.JOB_NOT_EXIST_ERROR, jobUpdate.getId()); } - + String originJobName = job.getName(); if (jobUpdate.getIsErrorDataOutputToDataSource()!= null && jobUpdate.getIsErrorDataOutputToDataSource()) { DataSource dataSource = dataSourceService.getDataSourceById(job.getDataSourceId()); if (dataSource != null) { @@ -207,7 +207,8 @@ public long update(JobUpdate jobUpdate) { }else { job.setName(jobUpdate.getJobName()); } - if (getByKeyAttribute(job)) { + // add check if the name has changed + if (getByKeyAttribute(job) && !org.apache.commons.lang3.StringUtils.equals(originJobName, job.getName())) { throw new DataVinesServerException(Status.JOB_EXIST_ERROR, job.getName()); } job.setUpdateBy(ContextHolder.getUserId());