Minor cleanups and fixes in helma.util.CronJob:
* Send sub-properties of app properties that start with "cron." so we don't have to do the filtering ourselves. * Be tolerant of whitespace in cron job time specs (e.g. cron.foo.minutes = 0, 15, 30, 45)
This commit is contained in:
parent
9066bd1b2e
commit
3e54355ef5
1 changed files with 6 additions and 9 deletions
|
@ -187,11 +187,8 @@ public class CronJob {
|
||||||
Enumeration e = props.keys ();
|
Enumeration e = props.keys ();
|
||||||
while (e.hasMoreElements ()) {
|
while (e.hasMoreElements ()) {
|
||||||
String key = (String) e.nextElement ();
|
String key = (String) e.nextElement ();
|
||||||
if (!key.startsWith ("cron."))
|
|
||||||
continue;
|
|
||||||
try {
|
try {
|
||||||
StringTokenizer st = new StringTokenizer (key.trim(), ".");
|
StringTokenizer st = new StringTokenizer (key.trim(), ".");
|
||||||
st.nextElement ();
|
|
||||||
String jobName = st.nextToken ();
|
String jobName = st.nextToken ();
|
||||||
if (jobName == null || jobName.equals(""))
|
if (jobName == null || jobName.equals(""))
|
||||||
continue;
|
continue;
|
||||||
|
@ -264,7 +261,7 @@ public class CronJob {
|
||||||
if (value.equals("*")) {
|
if (value.equals("*")) {
|
||||||
setAllYears(true);
|
setAllYears(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(value.trim(), ",");
|
StringTokenizer st = new StringTokenizer(value.trim(), ", \t\r\n");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String s = st.nextToken();
|
String s = st.nextToken();
|
||||||
if (s.indexOf("-") != -1) {
|
if (s.indexOf("-") != -1) {
|
||||||
|
@ -285,7 +282,7 @@ public class CronJob {
|
||||||
if (value.equals("*")) {
|
if (value.equals("*")) {
|
||||||
setAllMonths(true);
|
setAllMonths(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(value.trim(), ",");
|
StringTokenizer st = new StringTokenizer(value.trim(), ", \t\r\n");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String m = st.nextToken();
|
String m = st.nextToken();
|
||||||
if (m.equalsIgnoreCase("january"))
|
if (m.equalsIgnoreCase("january"))
|
||||||
|
@ -320,7 +317,7 @@ public class CronJob {
|
||||||
if (day.equals("*")) {
|
if (day.equals("*")) {
|
||||||
setAllDays(true);
|
setAllDays(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(day.trim(), ",");
|
StringTokenizer st = new StringTokenizer(day.trim(), ", \t\r\n");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String s = st.nextToken();
|
String s = st.nextToken();
|
||||||
if (s.indexOf("-") != -1) {
|
if (s.indexOf("-") != -1) {
|
||||||
|
@ -342,7 +339,7 @@ public class CronJob {
|
||||||
if (weekday.equals("*")) {
|
if (weekday.equals("*")) {
|
||||||
setAllWeekdays(true);
|
setAllWeekdays(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(weekday.trim(), ",");
|
StringTokenizer st = new StringTokenizer(weekday.trim(), ", \t\r\n");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String d = st.nextToken();
|
String d = st.nextToken();
|
||||||
if (d.equalsIgnoreCase("monday"))
|
if (d.equalsIgnoreCase("monday"))
|
||||||
|
@ -368,7 +365,7 @@ public class CronJob {
|
||||||
if (hour.equals("*")) {
|
if (hour.equals("*")) {
|
||||||
setAllHours(true);
|
setAllHours(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(hour.trim (), ",");
|
StringTokenizer st = new StringTokenizer(hour.trim (), ", \t\r\n\"");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String s = st.nextToken();
|
String s = st.nextToken();
|
||||||
if (s.indexOf("-") != -1) {
|
if (s.indexOf("-") != -1) {
|
||||||
|
@ -390,7 +387,7 @@ public class CronJob {
|
||||||
if (minute.equals("*")) {
|
if (minute.equals("*")) {
|
||||||
setAllMinutes(true);
|
setAllMinutes(true);
|
||||||
} else {
|
} else {
|
||||||
StringTokenizer st = new StringTokenizer(minute.trim (), ",");
|
StringTokenizer st = new StringTokenizer(minute.trim (), ", \t\r\n");
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String s = st.nextToken();
|
String s = st.nextToken();
|
||||||
if (s.indexOf("-") != -1) {
|
if (s.indexOf("-") != -1) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue