Skip to content

DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 #220

Closed
@ghost

Description

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)

Activity

dwbrock62

dwbrock62 commented on Aug 29, 2018

@dwbrock62

I have run into the same issue.

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[/+] on Feb 15, 2019
added a commit that references this issue on Feb 15, 2019

quartz-scheduler#220 bugifx: DailyTimeIntervalTrigger failed to set e…

added 2 commits that reference this issue on Feb 15, 2019

Merge pull request #358 from zemian/issue-220-dailytimeint-trigger-en…

487d748

Merge pull request #359 from zemian/issue-220-dailytimeint-trigger-en…

2aad042
zemian

zemian commented on Feb 15, 2019

@zemian
Contributor

This issue is now fixed

2 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @zemian@dwbrock62

        Issue actions

          DailyTimeIntervalTrigger failed to set endingDailyAfterCount = 1 · Issue #220 · quartz-scheduler/quartz