From 3e54355ef5de9230fb9bba18c175102d4ab15124 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 20 Sep 2007 08:11:01 +0000 Subject: [PATCH] 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) --- src/helma/util/CronJob.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/helma/util/CronJob.java b/src/helma/util/CronJob.java index db8ae7b6..158da038 100644 --- a/src/helma/util/CronJob.java +++ b/src/helma/util/CronJob.java @@ -187,11 +187,8 @@ public class CronJob { Enumeration e = props.keys (); while (e.hasMoreElements ()) { String key = (String) e.nextElement (); - if (!key.startsWith ("cron.")) - continue; try { StringTokenizer st = new StringTokenizer (key.trim(), "."); - st.nextElement (); String jobName = st.nextToken (); if (jobName == null || jobName.equals("")) continue; @@ -264,7 +261,7 @@ public class CronJob { if (value.equals("*")) { setAllYears(true); } else { - StringTokenizer st = new StringTokenizer(value.trim(), ","); + StringTokenizer st = new StringTokenizer(value.trim(), ", \t\r\n"); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.indexOf("-") != -1) { @@ -285,7 +282,7 @@ public class CronJob { if (value.equals("*")) { setAllMonths(true); } else { - StringTokenizer st = new StringTokenizer(value.trim(), ","); + StringTokenizer st = new StringTokenizer(value.trim(), ", \t\r\n"); while (st.hasMoreTokens()) { String m = st.nextToken(); if (m.equalsIgnoreCase("january")) @@ -320,7 +317,7 @@ public class CronJob { if (day.equals("*")) { setAllDays(true); } else { - StringTokenizer st = new StringTokenizer(day.trim(), ","); + StringTokenizer st = new StringTokenizer(day.trim(), ", \t\r\n"); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.indexOf("-") != -1) { @@ -342,7 +339,7 @@ public class CronJob { if (weekday.equals("*")) { setAllWeekdays(true); } else { - StringTokenizer st = new StringTokenizer(weekday.trim(), ","); + StringTokenizer st = new StringTokenizer(weekday.trim(), ", \t\r\n"); while (st.hasMoreTokens()) { String d = st.nextToken(); if (d.equalsIgnoreCase("monday")) @@ -368,7 +365,7 @@ public class CronJob { if (hour.equals("*")) { setAllHours(true); } else { - StringTokenizer st = new StringTokenizer(hour.trim (), ","); + StringTokenizer st = new StringTokenizer(hour.trim (), ", \t\r\n\""); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.indexOf("-") != -1) { @@ -390,7 +387,7 @@ public class CronJob { if (minute.equals("*")) { setAllMinutes(true); } else { - StringTokenizer st = new StringTokenizer(minute.trim (), ","); + StringTokenizer st = new StringTokenizer(minute.trim (), ", \t\r\n"); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.indexOf("-") != -1) {