Don't dump a stacktrace for invalid patterns when executing elasticse…#49744
Merged
dakrone merged 1 commit intoelastic:masterfrom Jan 2, 2020
Merged
Don't dump a stacktrace for invalid patterns when executing elasticse…#49744dakrone merged 1 commit intoelastic:masterfrom
dakrone merged 1 commit intoelastic:masterfrom
Conversation
Collaborator
|
Pinging @elastic/es-core-features (:Core/Features/Watcher) |
fbb8825 to
9988aa8
Compare
Member
|
@gaobinlong thanks for opening this! We discussed it and have some feedback. Would you be able to add an additional command line argument that will still allow someone to access the full stacktrace if needed? It would be off by default, but in place in the event more diagnostic information is needed. |
Contributor
Author
|
@dakrone OK, I will do that. |
Contributor
Author
|
@dakrone I have added -d(--detail) argument for elasticsearch-croneval, which can be used to print the stacktrace if the cron expression is not valid. Can you help to review the change? Thanks! |
dakrone
approved these changes
Jan 2, 2020
Member
dakrone
left a comment
There was a problem hiding this comment.
LGTM, thanks for iterating on this @gaobinlong, I'll merge this soon.
dakrone
pushed a commit
to dakrone/elasticsearch
that referenced
this pull request
Jan 2, 2020
SivagurunathanV
pushed a commit
to SivagurunathanV/elasticsearch
that referenced
this pull request
Jan 23, 2020
This was referenced Feb 3, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR is related to #49642.
When executing elasticsearch-croneval tool, it throws an exception and prints the stacktrace if the cron pattern is not valid. The change in this PR is catching the exception and printing the detail message only.
Before this change, when executing elasticsearch-croneval with invalid cron patterns:
./bin/elasticsearch-croneval "*"it prints:
Exception in thread "main" java.lang.IllegalArgumentException: invalid cron expression [*] at org.elasticsearch.xpack.core.watcher.support.Exceptions.illegalArgument(Exceptions.java:22) at org.elasticsearch.xpack.core.scheduler.Cron.<init>(Cron.java:275) at org.elasticsearch.xpack.core.scheduler.Cron.validate(Cron.java:792)After this change, it prints:
ERROR: invalid cron expression [illegal cron expression format [java.lang.IllegalArgumentException: unexpected end of expression at pos [1].]]