string expr = string.Format(" * * * * * {0}",
DateTime.Now.Year);
CronCalendar calendar = new CronCalendar(expr);
string fault = "дата исключена календарем";
Assert.IsFalse(calendar.IsTimeIncluded(DateTime.Now.AddMinutes(2)),
fault);
calendar.SetCronExpressionString("0 15 13 01 1980");
fault = "дата включена в календарь";
Assert.IsTrue(calendar.IsTimeIncluded(DateTime.Now.AddMinutes(2)),
fault);
The exception (index outside array bounds) is inside
CronExpression.GetTimeAfter() and TreeSet.First(). Part of faulty code
is as follows:
// get
second.................................................
st = seconds.TailSet(sec);
if (st != null && st.Count != 0)
{
sec = (int) st.First();
}
else
{
//exception here since both st.Count == 0 and
seconds.Count == 0
// I inserted if (seconds.Count > 0) to fix
sec = ((int) seconds.First());
<..>
-Marko
System.Exception: Support for specifying both a day-of-week AND a day-
of-month parameter is not implemented
That looks a bit strange - I don't specify a day-of-week, I specify
that day-of-week can be anything it can. And, besides,
System.Exception is not a good class to throw, I suppose. Maybe
ArgumentException or even some kind of Quartz exception would be
better.
I get the same exception when specifying 7 asterisks only as well and
specifying "30 * * * * TUE" and "0/30 * * * * * ?" and only when I
specify just "30" - I get "unexpected end of expression" (as I know,
cron expression is to be filled with all right asterisks when data is
ommitted, but I see it's not implemented)
And, besides, here are the lines from CronExpressionExample included
in Quartz
// job 1 will run every 20 seconds
JobDetail job = new JobDetail("job1", "group1", typeof(SimpleJob));
CronTrigger trigger = new CronTrigger("trigger1", "group1", "job1",
"group1", "0/20 * * * * ?");
Here, they think specifying only six figures in CronExpression is
quite legal.
When I specify "0/20 * * * * ?" instead of "0/20 * * * * ?" (one
extra whitespace) I get
System.FormatException: '?' can only be specfied for Day-of-Month or
Day-of-Week - maybe that is the trim you fixed?
In several hours I'll try to figure out actions to reproduce "index
out of bounds"
You can always open JIRA issue(s) when you find something inconvenient
or other bugs.
Thanks for all your detailed feedback on this.
-Marko