From f6176bc19d6d62bb9dd20748af080fcb1cfd9976 Mon Sep 17 00:00:00 2001
From: Oleg Nenashev
Date: Sun, 7 Jun 2015 00:16:38 +0300
Subject: [PATCH] [JENKINS-9283] - Don't accept invalid timezones, add form
validation
---
core/src/main/java/hudson/scheduler/CronTabList.java | 4 ++--
.../resources/hudson/triggers/TimerTrigger/help-spec.html | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/main/java/hudson/scheduler/CronTabList.java b/core/src/main/java/hudson/scheduler/CronTabList.java
index bb20834597..1bc90f3f42 100644
--- a/core/src/main/java/hudson/scheduler/CronTabList.java
+++ b/core/src/main/java/hudson/scheduler/CronTabList.java
@@ -108,9 +108,9 @@ public final class CronTabList {
if(lineNumber == 1 && line.startsWith("TZ=")) {
timezone = getValidTimezone(line.replace("TZ=",""));
if(timezone != null) {
- LOGGER.log(Level.CONFIG, "cron with timezone {0}", timezone);
+ LOGGER.log(Level.CONFIG, "CRON with timezone {0}", timezone);
} else {
- LOGGER.log(Level.CONFIG, "invalid timezone {0}", line);
+ throw new ANTLRException("Invalid or unsupported timezone '" + line + "'");
}
continue;
}
diff --git a/core/src/main/resources/hudson/triggers/TimerTrigger/help-spec.html b/core/src/main/resources/hudson/triggers/TimerTrigger/help-spec.html
index 901227dcef..0c076a29d1 100644
--- a/core/src/main/resources/hudson/triggers/TimerTrigger/help-spec.html
+++ b/core/src/main/resources/hudson/triggers/TimerTrigger/help-spec.html
@@ -89,7 +89,7 @@ H H 1,15 1-11 *
- Timezone specification should contain the "TZ=$(timezoneID)" string
- - If a timezone is not specified or if it is specified incorrectly, the default Jenkins JVM timezone will be used
+ - If a timezone is not specified, the default Jenkins JVM timezone will be used
- Th supports all timezones returned by
java.util.TimeZone::getAvailableIDs()