Affects: Spring Framework 5.3.1
Problem: Scheduled task marked with the annotation @Scheduled(cron = ""0 0 9 * * *"", zone = "Europe/Amsterdam")
did not run on March 28
Expected behaviour: The scheduled task should have run on March 28
How to reproduce: The bug seems to be related to the class CronExpression
introduced in version 5.3
ZonedDateTime current = ZonedDateTime.of(LocalDateTime.parse("2021-03-27T09:00:00"), ZoneId.of("Europe/Amsterdam"));
CronExpression cronExpression = CronExpression.parse("0 0 9 * * *");
ZonedDateTime next = cronExpression.next(current);
In this case the value returned by cronExpression.next()
is 2021-03-29T09:00:00
instead of the expected 2021-03-28T09:00:00
Comment From: guilroux
Hello,
Looks like there is still a problem for the following case :
ZonedDateTime current = ZonedDateTime.of(LocalDateTime.parse("2021-03-28T00:31:00"), ZoneId.of("Europe/Amsterdam"));
CronExpression cronExpression = CronExpression.parse("0 5 0 * * *");
ZonedDateTime next = cronExpression.next(current);
In this case the value returned by cronExpression.next()
is 2021-03-30T00:05
instead of the expected 2021-03-29T00:05
Comment From: sbrannen
@guilroux, please do not comment on closed tickets.
If you believe you have discovered a bug, please open a new ticket to report it.
Thanks