Repository navigation
Conversation
QuartzCronField only rejects '#' ordinals that are not positive, so an expression such as "0 0 0 ? * MON#6" parses without error but never fires: no month has a sixth Monday, and the adjuster always returns null. The mistake is only noticed when the task never runs. Accept ordinals from 1 to 5 only, as Quartz's own CronExpression does. Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QuartzCronFieldonly rejects#ordinals that are not positive. An expression such as0 0 0 ? * MON#6therefore parses without error but never fires: no month has a sixth Monday, so the adjuster always returnsnull, andCronExpression.next()never finds a match. The mistake only shows up when the scheduled task never runs.MON#3fires as expected.This change accepts ordinals from 1 to 5 only, as Quartz's own
CronExpressiondoes.QuartzCronFieldTests.invalidValuesnow also checks1#0,1#6andMON#6.Testing: the
org.springframework.scheduling.supporttests (221, includingCronExpressionTests,CronTriggerTestsandQuartzCronFieldTests),:spring-context:checkstyleMainandcheckstyleTestpass. 7.0.x and 6.2.x have the same code.The issue was found by an LLM-assisted tool and verified manually.