[JIRA] Created: (JENKINS-8669) CronTab.ceil on workdays returns day in the past

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[JIRA] Created: (JENKINS-8669) CronTab.ceil on workdays returns day in the past

Jenkins issues mailing list
CronTab.ceil on workdays returns day in the past
------------------------------------------------

                 Key: JENKINS-8669
                 URL: http://issues.jenkins-ci.org/browse/JENKINS-8669
             Project: Jenkins
          Issue Type: Bug
          Components: core
    Affects Versions: current
         Environment: tested 1.393 and 1.395
            Reporter: tofuatjava
            Priority: Critical


clone of [HUDSON-8656|http://issues.hudson-ci.org/browse/HUDSON-8656]

{code}
@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
}
{code}

--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[JIRA] Commented: (JENKINS-8669) CronTab.ceil on workdays returns day in the past

Jenkins issues mailing list

    [ http://issues.jenkins-ci.org/browse/JENKINS-8669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=145436#comment-145436 ]

nairb774 commented on JENKINS-8669:
-----------------------------------

Pull request can be found [here|https://github.com/jenkinsci/jenkins/pull/26].

> CronTab.ceil on workdays returns day in the past
> ------------------------------------------------
>
>                 Key: JENKINS-8669
>                 URL: http://issues.jenkins-ci.org/browse/JENKINS-8669
>             Project: Jenkins
>          Issue Type: Bug
>          Components: core
>    Affects Versions: current
>         Environment: tested 1.393 and 1.395
>            Reporter: tofuatjava
>            Assignee: nairb774
>            Priority: Critical
>
> clone of [HUDSON-8656|http://issues.hudson-ci.org/browse/HUDSON-8656]
> {code}
> @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
> }
> {code}

--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[JIRA] Resolved: (JENKINS-8669) CronTab.ceil on workdays returns day in the past

JIRA noreply@jenkins-ci.org
In reply to this post by Jenkins issues mailing list

     [ http://issues.jenkins-ci.org/browse/JENKINS-8669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nairb774 resolved JENKINS-8669.
-------------------------------

    Resolution: Fixed

Should be fixed as of 1.397

> CronTab.ceil on workdays returns day in the past
> ------------------------------------------------
>
>                 Key: JENKINS-8669
>                 URL: http://issues.jenkins-ci.org/browse/JENKINS-8669
>             Project: Jenkins
>          Issue Type: Bug
>          Components: core
>    Affects Versions: current
>         Environment: tested 1.393 and 1.395
>            Reporter: tofuatjava
>            Assignee: nairb774
>            Priority: Critical
>
> clone of [HUDSON-8656|http://issues.hudson-ci.org/browse/HUDSON-8656]
> {code}
> @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
> }
> {code}

--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira