
| Key: |
QRTZNET-149
|
| Type: |
Bug
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Blocker
|
| Assignee: |
Marko Lahma
|
| Reporter: |
Hippy
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
To duplicate:
- set the date to Jan.29-31
- create a CronTrigger and simple job that fires s short time in the future and uses the *day of the month* field in particular
- e.g. "0 0 0 29 1 ?"
The following code in the method is where it breaks (how about breaking that method up a bit, too? umpteen pages long!?):
if (day != t || mon != tmon)
{
if (mon > 12)
{
d = new DateTime(d.Year, 12, day, 0, 0, 0).AddMonths(mon - 12);
}
else
{
// THIS WILL BREAK EVENTUALLY WHEN THE TRIGGER FIRES!!!
// month will be February (i.e. 2) and day will be > 28
d = new DateTime(d.Year, mon, day, 0, 0, 0);
}
continue;
}
|
|
Description
|
To duplicate:
- set the date to Jan.29-31
- create a CronTrigger and simple job that fires s short time in the future and uses the *day of the month* field in particular
- e.g. "0 0 0 29 1 ?"
The following code in the method is where it breaks (how about breaking that method up a bit, too? umpteen pages long!?):
if (day != t || mon != tmon)
{
if (mon > 12)
{
d = new DateTime(d.Year, 12, day, 0, 0, 0).AddMonths(mon - 12);
}
else
{
// THIS WILL BREAK EVENTUALLY WHEN THE TRIGGER FIRES!!!
// month will be February (i.e. 2) and day will be > 28
d = new DateTime(d.Year, mon, day, 0, 0, 0);
}
continue;
} |
Show » |
|
I added a workaround piece of code and got the system running again.
This is not an optimal solution, but should work for most if not all of the cases where this occurs.
And I concur with the observation of the original poster that this method should be cleaned up...400 lines!!
if (day != t || mon != tmon)
{
if (mon > 12)
{
d = new DateTime(d.Year, 12, day, 0, 0, 0).AddMonths(mon - 12);
}
else
{
// This is to avoid a bug when moving from a month
//with 30 or 31 days to a month with less. Causes an invalid datetime to be instantiated.
// ex. 0 29 0 30 1 ? 2009 with clock set to 1/30/2009
int maxDays = DateTime.DaysInMonth( d.Year, mon );
if( day <= maxDays )
d = new DateTime(d.Year, mon, day, 0, 0, 0);
else
return null;
}
continue;
}