New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Valid quartz range expression is considered invalid. Range validations should be contextual to cron definition. #35
Comments
@Paqrat76 Thank you for reporting this!
Range valuesCurrent cron-utils implementation considers ranges should be specified writing A-B, where the following property should be always met: A<=B. If A>B, range is considered invalid. Monday value mappingcron-utils always maps strings to values MON->1 ... SUN->7, regardless of cron implementation (See: FieldConstraintBuilder::daysOfWeekMapping). |
@Paqrat76 issue solved. We rebuilt some parsing logic, and gained flexibility on how we represent crons and how we enforce validations. |
Version 3.1.0
Quartz parser fails for day-of-week range of SUN-SAT. The Quartz definition appears correct but when the Quartz-based parser is created, the "DAY_OF_WEEK" constraints.stringMapping values are incorrect. MON = 1 even though mondayDoWValue = 2.
Use following test in CronParserQuartzIntegrationTest to reproduce:
@test
public void testSunToSat() {
// FAILS SUN-SAT: SUN = 7 and SAT = 6
parser.parse("0 0 12 ? * SUN-SAT");
}
Stack trace:
java.lang.IllegalArgumentException: Bad range defined! Defined range should satisfy from <= to, but was [%s, %s]
at com.cronutils.model.field.expression.Between.validate(Between.java:63)
at com.cronutils.model.field.expression.Between.(Between.java:39)
at com.cronutils.model.field.expression.Between.(Between.java:31)
at com.cronutils.parser.field.FieldParser.parseBetween(FieldParser.java:93)
at com.cronutils.parser.field.FieldParser.parse(FieldParser.java:69)
at com.cronutils.parser.field.CronParserField.parse(CronParserField.java:68)
at com.cronutils.parser.CronParser.parse(CronParser.java:96)
at com.cronutils.parser.CronParserQuartzIntegrationTest.testSunToSat(CronParserQuartzIntegrationTest.java:129)
refer to debug values below:
The text was updated successfully, but these errors were encountered: