Skip to content

Commit 5ab966f

Browse files
committed
Polish contribution
See gh-28038
1 parent 7276752 commit 5ab966f

File tree

1 file changed

+7
-5
lines changed
  • spring-context/src/main/java/org/springframework/scheduling/support

1 file changed

+7
-5
lines changed

spring-context/src/main/java/org/springframework/scheduling/support/CronField.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public <T extends Temporal & Comparable<? super T>> T elapseUntil(T temporal, in
260260
* Roll forward the give temporal until it reaches the next higher
261261
* order field. Calling this method is equivalent to calling
262262
* {@link #elapseUntil(Temporal, int)} with goal set to the
263-
* minimum value of this field's range, except for daylight saving.
263+
* minimum value of this field's range.
264264
* @param temporal the temporal to roll forward
265265
* @param <T> the type of temporal
266266
* @return the rolled forward temporal
@@ -269,10 +269,12 @@ public <T extends Temporal & Comparable<? super T>> T rollForward(T temporal) {
269269
int current = get(temporal);
270270
ValueRange range = temporal.range(this.field);
271271
long amount = range.getMaximum() - current + 1;
272-
T result = this.field.getBaseUnit().addTo(temporal, amount);
273-
//adjust daylight saving
274-
if (get(result) != range.getMinimum()) {
275-
result = this.field.adjustInto(result,result.range(this.field).getMinimum());
272+
T result = this.field.getBaseUnit().addTo(temporal, amount);
273+
current = get(result);
274+
range = result.range(this.field);
275+
// adjust for daylight savings
276+
if (current != range.getMinimum()) {
277+
result = this.field.adjustInto(result, range.getMinimum());
276278
}
277279
return result;
278280
}

0 commit comments

Comments
 (0)