From 9455681d0013cfc00eb5b57abc95f392043930d3 Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Fri, 13 Dec 2019 10:30:31 -0500 Subject: [PATCH] Updated based on code review --- .../spi/scheduler/kubernetes/KubernetesScheduler.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/springframework/cloud/deployer/spi/scheduler/kubernetes/KubernetesScheduler.java b/src/main/java/org/springframework/cloud/deployer/spi/scheduler/kubernetes/KubernetesScheduler.java index 9e0c4650..242c4a5f 100644 --- a/src/main/java/org/springframework/cloud/deployer/spi/scheduler/kubernetes/KubernetesScheduler.java +++ b/src/main/java/org/springframework/cloud/deployer/spi/scheduler/kubernetes/KubernetesScheduler.java @@ -86,7 +86,7 @@ public void schedule(ScheduleRequest scheduleRequest) { } invalidCronExceptionMessage = getExceptionMessageForField(e, SCHEDULE_METADATA_FIELD_NAME); - if (isScheduleNameTooLong(invalidCronExceptionMessage)) { + if (validationScheduleNameLength(invalidCronExceptionMessage)) { throw new CreateScheduleException(invalidCronExceptionMessage, e); } @@ -211,11 +211,7 @@ private void setImagePullSecret(ScheduleRequest scheduleRequest, CronJob cronJob } } - private boolean isScheduleNameTooLong(String message ) { - boolean result = false; - if(StringUtils.hasText(message) && message.contains("must be no more than") && message.endsWith("characters")) { - result = true; - } - return result; + private boolean validationScheduleNameLength(String message ) { + return (StringUtils.hasText(message) && message.contains("must be no more than") && message.endsWith("characters")); } }