diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java index 87fe8d8581..f0e020fa46 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java @@ -2559,6 +2559,9 @@ public class ApiScenarioService extends MoveNodeService { if (StringUtils.isBlank(request.getCron()) && request.getConfig() == null) { this.batchUpdateSchedule(apiScenarios, request.isEnable(), operator); } else { + if (StringUtils.isBlank(request.getCron())) { + throw new MSException("Cron can not be null"); + } apiScenarios.forEach(apiScenario -> { ScheduleConfig scheduleConfig = ScheduleConfig.builder() .resourceId(apiScenario.getId()) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java index 93158d6f8f..9924e4b7eb 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanScheduleService.java @@ -46,6 +46,9 @@ public class TestPlanScheduleService { scheduleService.updateIfExist(testPlan.getId(), request.isEnable(), TestPlanScheduleJob.getJobKey(testPlan.getId()), TestPlanScheduleJob.getTriggerKey(testPlan.getId()), TestPlanScheduleJob.class, operator); } else { + if (StringUtils.isBlank(request.getCron())) { + throw new MSException("Cron can not be null"); + } ScheduleConfig scheduleConfig = ScheduleConfig.builder() .resourceId(testPlan.getId()) .key(testPlan.getId())