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

DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 #220

Closed
tim93422 opened this issue Mar 16, 2018 · 2 comments
Closed

DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 #220

tim93422 opened this issue Mar 16, 2018 · 2 comments

Comments

@tim93422
Copy link

This is probably due to me using the wrong trigger type, but if you only have one execution per day of a DailyTimeIntervalTrigger it fails with a message like: "StartTimeOfDay TimeOfDay[11:11:0] should not come after endTimeOfDay TimeOfDay[11:11:0]"

The problem appears to result from line 345 and 346 in DailyTimeIntervalScheduleBuilder

    long incrementInMillis = (count - 1) * intervalInMillis;
    Date endTimeOfDayDate = new Date(startTimeOfDayDate.getTime() + incrementInMillis);

These two lines set the start time equal to the end time which then blows up in DailyTimeIntervalTriggerImpl on line 857 which throws an exception if the start time is not before the end time.

  DailyTimeIntervalTrigger trigger = newTrigger()
    		.withIdentity("trigger1", "group1")
    		.startAt(startDay)
        	.withSchedule(dailyTimeIntervalSchedule()
            				.onDaysOfTheWeek(Calendar.MONDAY)
            				.startingDailyAt(start)
            				.endingDailyAfterCount(1)
            				.withRepeatCount(2))
        	.build();

The exception stack trace is:

org.quartz.SchedulerException: StartTimeOfDay TimeOfDay[11:11:0] should not come after endTimeOfDay TimeOfDay[11:11:0]
	at org.quartz.impl.triggers.DailyTimeIntervalTriggerImpl.validate(DailyTimeIntervalTriggerImpl.java:858)
	at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:842)
	at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)
	at calpers.ais.sample.quartz.calendar.SimpleQuartzTest.scheduledJobForSaturdayShouldRunMonday(SimpleQuartzTest.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
@dwbrock62
Copy link

I have run into the same issue.

@zemian zemian added the bug label Jan 3, 2019
@zemian zemian changed the title dailyTimeIntervalSchedule()...endingDailyAfterCount(1)... fails with StartTimeOfDay TimeOfDay[11:11:0] should not come after endTimeOfDay TimeOfDay[11:11:0] DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 Feb 15, 2019
zemian added a commit to zemian/quartz that referenced this issue Feb 15, 2019
zemian added a commit that referenced this issue Feb 15, 2019
…dtime

 DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 #220
zemian added a commit that referenced this issue Feb 15, 2019
…dtime-master

DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 #220
@zemian
Copy link
Contributor

zemian commented Feb 15, 2019

This issue is now fixed

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

3 participants