From 2c4473ee439f9ded3872e4f49b54f361eee8acda Mon Sep 17 00:00:00 2001 From: Kerwin <37063904+zhuangchong@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:09:20 +0800 Subject: [PATCH] cherry pick #10523 (#10524) --- .../dolphinscheduler/service/quartz/cron/CronUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java index 49810cd1f4..f8afd1f95c 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java @@ -127,7 +127,7 @@ public class CronUtils { while (Stopper.isRunning()) { startTime = cronExpression.getNextValidTimeAfter(startTime); - if (startTime.after(endTime)) { + if (startTime == null || startTime.after(endTime)) { break; } dateList.add(startTime); @@ -149,7 +149,7 @@ public class CronUtils { List dateList = new ArrayList<>(); while (fireTimes > 0) { startTime = cronExpression.getNextValidTimeAfter(startTime); - if (startTime.after(endTime) || startTime.equals(endTime)) { + if (startTime == null || startTime.after(endTime) || startTime.equals(endTime)) { break; } dateList.add(startTime); @@ -172,7 +172,7 @@ public class CronUtils { while (Stopper.isRunning()) { startTime = cronExpression.getNextValidTimeAfter(startTime); - if (startTime.after(endTime) || startTime.equals(endTime)) { + if (startTime == null || startTime.after(endTime) || startTime.equals(endTime)) { break; } dateList.add(startTime);