Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8669

CronTab.ceil on workdays returns day in the past

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:
      tested 1.393 and 1.395
    • Similar Issues:

      Description

      clone of HUDSON-8656

      @Test
      public void testHudsonCeil() throws ANTLRException {
        final Calendar cal = Calendar.getInstance();
        cal.set(2011, 0, 16, 0, 0, 0); // Sunday, Jan 16th 2011, 00:00
        final String cronStr = "0 23 * * 1-5"; // execute on weekdays @23:00
        final CronTab cron = new CronTab(cronStr);
        final Calendar next = cron.ceil(cal);
        final Calendar expectedDate = Calendar.getInstance();
        expectedDate.set(2011, 0, 17, 23, 0, 0); // Expected next: Monday, Jan 17th 2011, 23:00
        Assert.assertEquals(expectedDate.get(Calendar.HOUR), next.get(Calendar.HOUR));
        Assert.assertEquals(expectedDate.get(Calendar.MINUTE), next.get(Calendar.MINUTE));
        Assert.assertEquals(expectedDate.get(Calendar.YEAR), next.get(Calendar.YEAR));
        Assert.assertEquals(expectedDate.get(Calendar.MONTH), next.get(Calendar.MONTH));
        Assert.assertEquals(expectedDate.get(Calendar.DAY_OF_MONTH), next.get(Calendar.DAY_OF_MONTH)); // FAILS: is Monday, Jan 10th, 23:00
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            nairb774 nairb774 added a comment -

            Pull request can be found here.

            Show
            nairb774 nairb774 added a comment - Pull request can be found here .
            Hide
            nairb774 nairb774 added a comment -

            Should be fixed as of 1.397

            Show
            nairb774 nairb774 added a comment - Should be fixed as of 1.397

              People

              • Assignee:
                nairb774 nairb774
                Reporter:
                tofuatjava Thomas F├╝rer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: