You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found a cron line and timestamp pair that violates sane ordering of the CronSequenceGenerator#next(Date) function.
Demonstration test below:
@TestpublicvoiddemonstrateBug() {
//I've found a cron line and timestamp pair that violates sane ordering of the CronSequenceGenerator#next(Date) function.longworkingTimeStamp = 1468850400000L; //18 Jul 2016 14:00:00 GMTlongproblemTimeStamp = 1468867460443L; //18 Jul 2016 18:44:20.443 GMTStringcronLine = "*/3 * 13 * * *"; //cron line that causes issues, found by fuzz testingCronSequenceGeneratorgenerator = newCronSequenceGenerator(cronLine, TimeZone.getTimeZone("UTC")); //standard generator using that cron lineDatecorrectNextRun = generator.next(newDate(workingTimeStamp));
longcorrectNextRunTime = correctNextRun.getTime(); //correctly finds 1468933200000L//demonstrate that the problem timestamp is between the working timestamp and its next runAssert.assertTrue(workingTimeStamp < problemTimeStamp);
Assert.assertTrue(problemTimeStamp < correctNextRunTime);
//this means that, since the problem timestamp is between the working one and its next run, getting the next run of the problem timestamp should result in the SAME next run as the one from the working timestampDatefaultyNextRun = generator.next(newDate(problemTimeStamp));
longfaultyNextRunTime = faultyNextRun.getTime(); //incorrectly finds 1468933221000LAssert.assertEquals(correctNextRunTime, faultyNextRunTime); //THIS FAILS, demonstrating the bug.
}
Scott Albertine opened SPR-14480 and commented
I've found a cron line and timestamp pair that violates sane ordering of the CronSequenceGenerator#next(Date) function.
Demonstration test below:
Affects: 4.3.1
Issue Links:
The text was updated successfully, but these errors were encountered: