From 5ab966fbdefc33840ff2ac4c12b26a6c306b59cf Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 16 Feb 2022 11:16:27 +0100 Subject: [PATCH] Polish contribution See gh-28038 --- .../scheduling/support/CronField.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java index e01e00b632..adc2c2ffe5 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronField.java @@ -260,7 +260,7 @@ abstract class CronField { * Roll forward the give temporal until it reaches the next higher * order field. Calling this method is equivalent to calling * {@link #elapseUntil(Temporal, int)} with goal set to the - * minimum value of this field's range, except for daylight saving. + * minimum value of this field's range. * @param temporal the temporal to roll forward * @param the type of temporal * @return the rolled forward temporal @@ -269,10 +269,12 @@ abstract class CronField { int current = get(temporal); ValueRange range = temporal.range(this.field); long amount = range.getMaximum() - current + 1; - T result = this.field.getBaseUnit().addTo(temporal, amount); - //adjust daylight saving - if (get(result) != range.getMinimum()) { - result = this.field.adjustInto(result,result.range(this.field).getMinimum()); + T result = this.field.getBaseUnit().addTo(temporal, amount); + current = get(result); + range = result.range(this.field); + // adjust for daylight savings + if (current != range.getMinimum()) { + result = this.field.adjustInto(result, range.getMinimum()); } return result; }