Skip to content
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

Is there a chance to have CronMapper from QUARTZ to SPRING53 ? #579

Open
unstoppable95 opened this issue Feb 24, 2023 · 2 comments
Open

Comments

@unstoppable95
Copy link

unstoppable95 commented Feb 24, 2023

Hi guys,
I'd like to have a mapper from QUARTZ format to SPRING53 as I need to support additional L, # for days of the week and L,W day of the month. After creating my custom one and calling .map method I keep getting a problem that "value missing for a#b cron expresion" even it it's already there inside Cron when I call mapper.map() method (from is quartz definition and to is spring53 type inside CronMapper constuctor). Is there a chance to support this feature in upcoming weeks/months?

@jmrozanec
Copy link
Owner

@unstoppable95 could you provide some PR with a test, to reproduce the issue?

@unstoppable95
Copy link
Author

just add new static method in CronMapper class:
public static CronMapper fromQuartzToSpring53() { return new CronMapper( CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ), CronDefinitionBuilder.instanceDefinitionFor(CronType.SPRING53), setQuestionMark() ); }

and then try to use in some test e.g:
@Test public void testRangeOfTimeQuartzToSpring53() { final String expected = "0 15 10 ? * 5#3"; final String expression = "0 15 10 ? * 6#3 1984"; assertEquals(expected, CronMapper.fromQuartzToSpring53().map(quartzParser().parse(expression)).asString()); }

and this results in "IllegalArgumentExpression....value missing for a#b cron expression" and main problem is in inside
at com.cronutils.model.field.expression.On.(On.java:43), not sure if this precondition check there is correct.

Regards & sorry for not creating PR, I did not have git installed on this PC and can't to this without local admin role...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants