You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/03/09 13:46:38 UTC

[jira] [Commented] (AMQ-5645) CronParser.getNextScheduledTime() for the first day of every month

    [ https://issues.apache.org/jira/browse/AMQ-5645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14352933#comment-14352933 ] 

ASF GitHub Bot commented on AMQ-5645:
-------------------------------------

GitHub user mwarhaftig opened a pull request:

    https://github.com/apache/activemq/pull/69

    AMQ-5645 - Updated DayOfMonth cron to roll to next month properly.

    For the Minutes and Hours tokens in CronParser.buildCronEntries() the CronEntry.end value was correctly +1 of actually allowed end values (ex. a time of 10:60 is not possible).  Updated DayOfMonth to also be +1 (32 instead of 31).  Expanded unit tests included.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mwarhaftig/activemq amq5645

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq/pull/69.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #69
    
----
commit e9f75c509c6244ca44e817663a3411afa68b4a41
Author: Matt Warhaftig <mw...@gmail.com>
Date:   2015-03-09T12:22:55Z

    AMQ-5645 - Updated DayOfMonth cron to roll to next month properly.

----


> CronParser.getNextScheduledTime() for the first day of every month
> ------------------------------------------------------------------
>
>                 Key: AMQ-5645
>                 URL: https://issues.apache.org/jira/browse/AMQ-5645
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.0, 5.11.0
>         Environment: Windows, Java 1.6
>            Reporter: Toni Ramírez
>
> When we try to get a NextSecheduledTime for a cron string that should return next month's first day ("0 1 1 * *") we get current month's last day.
> For example:
> 	public static void main(String[] args){
> 		
> 		try{
> 		
> 			Date miFecha = new Date(CronParser.getNextScheduledTime("0 1 1 * *", System.currentTimeMillis()));
> 				
> 			System.out.println(miFecha);
> 			
> 			
> 		}catch(Exception e){
> 		
> 			e.printStackTrace();
> 		}	
> 		
> 		
> 	}
> This prints:
> Tue Mar 31 01:00:00 CEST 2015



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)