Lauri Kimmel opened SPR-17036 and commented

Unit test below is failing with message Overflow in day for expression "0 0 0 13 * FRI"

    public void testFriday13Failure() {

        String cronExpression = "0 0 0 13 * FRI";

        assertThat(CronSequenceGenerator.isValidExpression(cronExpression), is(true));

        CronSequenceGenerator gen = new CronSequenceGenerator(cronExpression);

        Instant instant = Instant.parse("2018-07-13T11:47:14Z");

        gen.next(Date.from(instant));

    }

2018-07-13 is Friday 13th; 2019-09-13 is next Friday 13th; there are 427 days between which is exceeding max limit 366 in CronSequenceGenerator.findNextDay().


Affects: 4.3.10

Issue Links: - #13621 Cron expression with fixed weekday and fixed date may or may not lead to IllegalStateException (runaway search for next trigger)

Comment From: spring-projects-issues

Lauri Kimmel commented

Although tested with version 4.3.10 I'm assuming it's affecting newer releases as well since implementation has not been changed for years.

Comment From: spring-projects-issues

Lauri Kimmel commented

Looks to be related to #13621.

Comment From: sbrannen

I have confirmed that this is a bug when running the supplied test against master.