You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/03/14 08:41:10 UTC

[dolphinscheduler] branch dev updated: fix create&update wrokflow cron APIs, verify end time must bigger than start time (#8871)

This is an automated email from the ASF dual-hosted git repository.

caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1f83140  fix create&update wrokflow cron APIs, verify end time must bigger than start time (#8871)
1f83140 is described below

commit 1f831405588626cec0f6d27b97695895d0ee7108
Author: Tq <ti...@gmail.com>
AuthorDate: Mon Mar 14 16:40:07 2022 +0800

    fix create&update wrokflow cron APIs, verify end time must bigger than start time (#8871)
---
 .../api/service/impl/SchedulerServiceImpl.java                | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
index e46672f..49b3f1f 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
@@ -168,6 +168,11 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
             putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
             return result;
         }
+        if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
+            logger.warn("The start time must smaller than end time");
+            putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
+            return result;
+        }
         scheduleObj.setStartTime(scheduleParam.getStartTime());
         scheduleObj.setEndTime(scheduleParam.getEndTime());
         if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {
@@ -649,6 +654,12 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
                 putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
                 return;
             }
+            if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
+                logger.warn("The start time must smaller than end time");
+                putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
+                return;
+            }
+
             schedule.setStartTime(scheduleParam.getStartTime());
             schedule.setEndTime(scheduleParam.getEndTime());
             if (!org.quartz.CronExpression.isValidExpression(scheduleParam.getCrontab())) {