Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watcher: Use joda method to get local TZ #35608

Merged
merged 4 commits into from
Nov 16, 2018
Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Nov 15, 2018

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

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 elastic#35518
@rjernst rjernst added >test Issues or PRs that are addressing/adding tests v7.0.0 :Data Management/Watcher v6.6.0 labels Nov 15, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@@ -31,7 +30,7 @@ public static void main(String[] args) throws Exception {
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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I think it would be a bit more obvious to explicitly call DateTimeZone.getDefault() instead of null.
Since that is what Joda does with the null value.
http://joda-time.sourceforge.net/apidocs/src-html/org/joda/time/DateTimeZone.html#line.301

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! the recommendation is forbidden API ..never mind.

@jakelandis
Copy link
Contributor

looks like the test failure may be related to the change

@rjernst
Copy link
Member Author

rjernst commented Nov 16, 2018

The failure is odd...it does not reproduce for me. I also ran 100 iterations and I do not get any failures...

@jakelandis
Copy link
Contributor

LGTM

@rjernst rjernst merged commit 3c03975 into elastic:master Nov 16, 2018
@rjernst rjernst deleted the cron_eval_tz branch November 16, 2018 23:46
@rjernst rjernst removed the v6.6.0 label Nov 16, 2018
@rjernst
Copy link
Member Author

rjernst commented Nov 16, 2018

Upon attempting to back port, I found the 6.x code does not have the local formatter, so I've only applied this change to master.

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Nov 17, 2018
* master: (59 commits)
  SQL: Move internals from Joda to java.time (elastic#35649)
  Add HLRC docs for Get Lifecycle Policy (elastic#35612)
  Align RolloverStep's name with other step names (elastic#35655)
  Watcher: Use joda method to get local TZ (elastic#35608)
  Fix line length for org.elasticsearch.action.* files (elastic#35607)
  Remove use of AbstractComponent in server (elastic#35444)
  Deprecate types in count and msearch. (elastic#35421)
  Refactor an ambigious TermVectorsRequest constructor. (elastic#35614)
  [Scripting] Use Number as a return value for BucketAggregationScript (elastic#35653)
  Removes AbstractComponent from several classes (elastic#35566)
  [DOCS] Add beta warning to ILM pages. (elastic#35571)
  Deprecate types in validate query requests. (elastic#35575)
  Unmute BuildExamplePluginsIT
  Revert "AwaitsFix the RecoveryIT suite - see elastic#35597"
  Revert "[RCI] Check blocks while having index shard permit in TransportReplicationAction (elastic#35332)"
  Remove remaining line length violations for o.e.action.admin.cluster (elastic#35156)
  ML: Adjusing BWC version post backport to 6.6 (elastic#35605)
  [TEST] Replace fields in response with actual values
  Remove usages of CharSequence in Sets (elastic#35501)
  AwaitsFix the RecoveryIT suite - see elastic#35597
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Watcher >test Issues or PRs that are addressing/adding tests v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joda time unable to handle some timezones causing test failure
4 participants