SPR-7239: fix CronTrigger
This commit is contained in:
@@ -68,7 +68,6 @@ public class CronSequenceGenerator {
|
||||
|
||||
private final TimeZone timeZone;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a {@link CronSequenceGenerator} from the pattern provided.
|
||||
* @param expression a space-separated list of time fields
|
||||
@@ -81,7 +80,6 @@ public class CronSequenceGenerator {
|
||||
parse(expression);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the next {@link Date} in the sequence matching the Cron pattern and
|
||||
* after the value provided. The return value will have a whole number of
|
||||
@@ -156,13 +154,13 @@ public class CronSequenceGenerator {
|
||||
if (dayOfMonth == updateDayOfMonth) {
|
||||
resets.add(Calendar.DAY_OF_MONTH);
|
||||
} else {
|
||||
doNext(calendar);
|
||||
doNext(calendar);
|
||||
}
|
||||
|
||||
int month = calendar.get(Calendar.MONTH);
|
||||
int updateMonth = findNext(this.months, month, calendar, Calendar.MONTH, Calendar.YEAR, resets);
|
||||
if (month != updateMonth) {
|
||||
doNext(calendar);
|
||||
doNext(calendar);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -314,6 +312,9 @@ public class CronSequenceGenerator {
|
||||
result[0] = Integer.valueOf(split[0]);
|
||||
result[1] = Integer.valueOf(split[1]);
|
||||
}
|
||||
if (result[0] >= max || result[1] >= max) {
|
||||
throw new IllegalArgumentException("Range exceeds maximum (" + max + "): " + field);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,5 +74,10 @@ public class CronTrigger implements Trigger {
|
||||
public int hashCode() {
|
||||
return this.sequenceGenerator.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sequenceGenerator.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user