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

cron-utils fails to describe weekday list #39

Closed
PrasadaRaoK opened this issue Sep 8, 2015 · 5 comments
Closed

cron-utils fails to describe weekday list #39

PrasadaRaoK opened this issue Sep 8, 2015 · 5 comments

Comments

@PrasadaRaoK
Copy link

When we select cron expression as weekly Monday and Tuesday the expression is coming like
0 0 0 ? * MON,TUE *

exception got while parsing the cron expression.

in hours tab
image

image

@jmrozanec
Copy link
Owner

@PrasadaRaoK Thank you for using cron-utils! May I ask you for a test to reproduce the issue? I am unable to reproduce it for now. Below I paste the test I created:

CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
parser.parse("0 0 0 ? * MON,TUE *");
//works as expected

@jmrozanec
Copy link
Owner

@PrasadaRaoK Please provide a test to reproduce the issue. Otherwise we will close the issue as unable to reproduce. Thank you!

@PrasadaRaoK
Copy link
Author

I used the below code to parse the expression "0 0 0 ? * MON,TUE *"

I tried with your code also
CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));


CronDefinition cronDefinition = CronDefinitionBuilder.defineCron()
.withSeconds().and()
.withMinutes().and()
.withHours().and()
.withDayOfMonth()
.supportsHash().supportsL().supportsLW().supportsW().supportsQuestionMark().and()
.withMonth().and()
.withDayOfWeek()
.withMondayDoWValue(1)
.withIntMapping(7, 0)
.supportsHash().supportsL().supportsLW().supportsW().supportsQuestionMark().and()
.withYear().and()
.lastFieldOptional()
.instance();

        CronParser parser = new CronParser(cronDefinition);
        Cron quartzCron = parser.parse(cronExpression);
        CronDescriptor descriptor = CronDescriptor.instance(Locale.ENGLISH);
        readableExpression = descriptor.describe(quartzCron);

@jmrozanec
Copy link
Owner

@PrasadaRaoK Thank you for providing the example. I was able to reproduce it and created a test for it. The issue happens when describing the cron pattern. I found where it lays; still need to find a good way to fix this.

@jmrozanec jmrozanec changed the title Unparsable Format cron-utils fails to describe weekday list Sep 11, 2015
@jmrozanec
Copy link
Owner

@PrasadaRaoK Issue fixed!

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

No branches or pull requests

2 participants