History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-595
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Jacob
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

When user Cron Expression 0 0 19 LW * ?, and Australia/Sydney timezone local computer is GMT, the next firetime will always be the current day when the last day of the month is on a weekend.

Created: 29/Jun/07 05:10 PM   Updated: 21/Aug/07 11:50 PM
Component/s: Triggers
Affects Version/s: 1.4.2
Fix Version/s: 1.6.1

File Attachments: 1. Java Source File CronExpression.java (55 kb)

Environment: I have tested on many environments, the easiest way to show is in the description below. We tested with 1.6 as well.


 Description  « Hide
Set local system time to be Friday June 29th 2007 1700h

Using the source in CronTrigger I edited the main method that was already there lby changing 2 lines.

public static void main(String[] args) // TODO: remove method after good
        // unit testing
        throws Exception {

        String expr = "0 0 19 LW * ?";
       ...
        ct.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
        ...
}
The print out is this (And the unhappy results in our production environment) are

seconds: 0
minutes: 0
hours: 19
daysOfMonth:
months: *
daysOfWeek: ?
lastdayOfWeek: false
nearestWeekday: true
NthDayOfWeek: 0
lastdayOfMonth: true
years: *

tz=Australia/Sydney

firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007
firetime = Fri Jun 29 05:00:00 EDT 2007

Will fire on: Thu May 17 23:00:07 EDT 2007 -- false




 All   Comments   Change History      Sort Order:
Jacob - [29/Jun/07 05:13 PM ]
Please change the last sentence in the heading to say ... when the last day of the month is on a weekend.

Thanks,

If you need anything else, let me know.

Henri Yandell - [02/Jul/07 10:18 AM ]
Updating as per comment.

Jacob - [16/Jul/07 10:19 AM ]
James,
I appreciate the fact that there are many issues assigned to you, and you may not get to this in the near future. The reason I replorted it was in hopes that there would be a fix by someone more familiar with the source than I am. I think the is in Trigger.getNextFireTime(), but because there are many potential side effects, I hesitate to try and fix this myself.

This issue will affect our production environment again at the end of September. (When the last day of the month falls on a weekend) Please let me know if you are NOT going to tackle this in the near future, so that I can start digging into the source and make my own fix ASAP.

Thanks,

Jake

James House - [16/Jul/07 10:31 AM ]
Yes, unfortunately it may be some weeks before I get to it... I'm very swamped with non-Quartz things, so it's kind-of on the back burner, as it's not my day job. As much as I'd like to have more time for it, it's hard enough to make time for the wife&kids when you're already working ~65 hours / week...

If you come up with a patch, I'll try to make the time to review it.

Jacob - [16/Jul/07 10:42 AM ]
Thanks for getting back to me. I will have a patch in a couple days. If you could review it, I would really appreciate it.

-Jake

Jacob - [19/Jul/07 08:14 AM ]

                        //JH Jul 19, 2007 - Added timezone to Calendar for comparison.
                        //java.util.Calendar tcal = java.util.Calendar.getInstance();
                        java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());


Jacob - [19/Jul/07 08:18 AM ]
James, This is the fix I put into place in the CronExpression Class. I also attached the source. This may not be a compete fix because I noticed that there are other places where
 java.util.Calendar tcal = java.util.Calendar.getInstance();
is compared with
Calendar cl = Calendar.getInstance(getTimeZone());

Could you give me your opinion of whether it is safe to add getTimeZone() to the instatiation of ALL Calendars to be compared?

Thanks,

Jake

James House - [21/Aug/07 11:43 PM ]
Sorry for being slow to respond. Somehow I missed the notification of your last comment, and I've been so busy I'm just now doing a general review of open issues.

Anyhow, yes, I think it is correct to add the timeZone to all calls to Calendar.getInstance() ... and will be doing so before this issue is closed.

James House - [21/Aug/07 11:50 PM ]
the change is now checked in.