diff --git a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java index 95173a2..03bd8be 100644 --- a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java +++ b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildGlobalConfiguration.java @@ -45,7 +45,7 @@ public static ScheduleBuildGlobalConfiguration get() { // time portion (hours, minutes, seconds, etc.) while the date // portion is ignored. private transient Date defaultScheduleTime; - private String timeZone; + private ZoneId timeZone; private String defaultStartTime; @@ -61,7 +61,7 @@ public static ScheduleBuildGlobalConfiguration get() { @DataBoundConstructor public ScheduleBuildGlobalConfiguration() { - this.timeZone = TimeZone.getDefault().getID(); + this.timeZone = ZoneId.systemDefault(); defaultStartTime = "22:00:00"; load(); defaultScheduleLocalTime = LocalTime.parse(defaultStartTime, getTimeFormatter()); @@ -116,21 +116,21 @@ private LocalTime parseTime(String time) { } public String getTimeZone() { - return timeZone; + return timeZone.toString(); } @DataBoundSetter public void setTimeZone(String timeZone) { - this.timeZone = timeZone; + try { + this.timeZone = ZoneId.of(timeZone); + } catch (DateTimeException e) { + this.timeZone = ZoneId.systemDefault(); + } save(); } public ZoneId getZoneId() { - try { - return ZoneId.of(timeZone); - } catch (DateTimeException dte) { - return ZoneId.systemDefault(); - } + return timeZone; } private DateTimeFormatter getTimeFormatter() { @@ -178,7 +178,7 @@ public ListBoxModel doFillTimeZoneItems() { ListBoxModel items = new ListBoxModel(); Set zoneIds = new TreeSet<>(ZoneId.getAvailableZoneIds()); for (String id : zoneIds) { - if (id.equalsIgnoreCase(timeZone)) { + if (id.equalsIgnoreCase(timeZone.toString())) { items.add(new ListBoxModel.Option(id, id, true)); } else { items.add(id); diff --git a/src/main/resources/META-INF/hudson.remoting.ClassFilter b/src/main/resources/META-INF/hudson.remoting.ClassFilter new file mode 100644 index 0000000..01ff0ec --- /dev/null +++ b/src/main/resources/META-INF/hudson.remoting.ClassFilter @@ -0,0 +1,2 @@ +java.time.ZoneRegion +java.time.ZoneId