提交 17e7d7a1 编写于 作者: K Kohsuke Kawaguchi

minor touch-up and documentation

as I was playing with it to understand what those logics mean.
上级 4335d96b
......@@ -443,13 +443,15 @@ public final class CronTab {
* @since XXX
*/
public static @CheckForNull String hashify(String spec) {
if (spec.startsWith("*/")) {
if (spec.contains("H")) {
// if someone is already using H, presumably he knows what it is, so a warning is likely false positive
return null;
} else if (spec.startsWith("*/")) {// "*/15 ...." (every N minutes) to hash
return "H" + spec.substring(1);
} else if (spec.matches("\\d+ .+")) {
} else if (spec.matches("\\d+ .+")) {// "0 ..." (certain minute) to hash
return "H " + spec.substring(spec.indexOf(' ') + 1);
} else {
return null;
}
}
}
......@@ -187,6 +187,8 @@ public class CronTabTest {
assertEquals(Messages.CronTab_spread_load_evenly_by_using_rather_than_("H * * * *", "0 * * * *"), new CronTab("0 * * * *").checkSanity());
// if the user specifically asked for 3:00 AM, probably we should stick to 3:00–3:59
assertEquals(Messages.CronTab_spread_load_evenly_by_using_rather_than_("H 3 * * *", "0 3 * * *"), new CronTab("0 3 * * *").checkSanity());
assertEquals(null, new CronTab("H/15 * 1 1 *").checkSanity());
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册