Uploaded image for project: 'Quartz Scheduler (Historical - Do Not File New Issues Here - See GitHub)'
  1. Quartz Scheduler (Historical - Do Not File New Issues Here - See GitHub)
  2. QTZ-157

TiggerBuilder can't build a Cron trigger with start and end date when endDate is prior to current sys date

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 2 Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: Triggers
    • Labels:
      None
    • Terracotta Target:
      Quartz 2.1.0
    • Fixed In Revision:
      1584

      Description

      I've run into a case where I can't instantiate a Cron trigger via the TriggerBuilder if the end date is prior to the system date.

      I'm rolling up our environment to 2.0 and we had a test that was using a date set in the past in order to verify that our triggers and jobs are being set properly.

      However, due to the fact that in the TriggerBuilder the end date is set prior to the start date and that the startDate defaults to the sys date it is blowing the validation call in setEndDate.

      This will allow the trigger to be built

              return TriggerBuilder.newTrigger()
                      .withIdentity("some trigger name", "some trigger group")
                      .forJob("some job name", "some job group")
                      .startAt(new Date(System.currentTimeMillis() - 200000000))
                      .endAt(new Date(System.currentTimeMillis() + 100000000))
                      .withSchedule(CronScheduleBuilder.cronSchedule())
                      .build();
      

      While this will not

              return TriggerBuilder.newTrigger()
                      .withIdentity("some trigger name", "some trigger group")
                      .forJob("some job name", "some job group")
                      .startAt(new Date(System.currentTimeMillis() - 200000000))
                      .endAt(new Date(System.currentTimeMillis() - 100000000))
                      .withSchedule(CronScheduleBuilder.cronSchedule())
                      .build();
      

      The only different being the endAt date.

      Note that with while the first snippet will allow the trigger to build I end up getting the
      org.quartz.JobPersistenceException: Couldn't store job: ORA-00933: SQL command not properly ended which I believe has already been fixed.

      I originally thought I'd be able to work around it by just bailing out to using the CronTriggerImpl directly but then the record can't be retrieved from the JobStore with the endDate before startDate issue which blew when I actually tried to look it up to delete it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jhouse James House
                Reporter:
                vampboy Shawn Clowater
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: