Browse Source

Watcher: Use joda method to get local TZ (#35608)

This commit switches from using java util's default timezone method to
using joda. The former can cause problems when the string representation
of the timezone is unknown to joda.

closes #35518
Ryan Ernst 7 years ago
parent
commit
3c03975ce3

+ 1 - 2
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalTool.java

@@ -20,7 +20,6 @@ import org.joda.time.format.DateTimeFormatter;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
-import java.util.TimeZone;
 
 public class CronEvalTool extends LoggingAwareCommand {
 
@@ -31,7 +30,7 @@ public class CronEvalTool extends LoggingAwareCommand {
     private static final DateTimeFormatter UTC_FORMATTER = DateTimeFormat.forPattern("EEE, d MMM yyyy HH:mm:ss")
         .withZone(DateTimeZone.UTC).withLocale(Locale.ROOT);
     private static final DateTimeFormatter LOCAL_FORMATTER = DateTimeFormat.forPattern("EEE, d MMM yyyy HH:mm:ss Z")
-        .withZone(DateTimeZone.forTimeZone(TimeZone.getDefault()));
+        .withZone(DateTimeZone.forTimeZone(null));
 
     private final OptionSpec<Integer> countOption;
     private final OptionSpec<String> arguments;