XContent: Factor deprecation handling into callback#28449
Merged
nik9000 merged 4 commits intoelastic:masterfrom Jan 30, 2018
Merged
XContent: Factor deprecation handling into callback#28449nik9000 merged 4 commits intoelastic:masterfrom
nik9000 merged 4 commits intoelastic:masterfrom
Conversation
Factors the way in which XContent parsing handles deprecated fields into a callback that is set at parser construction time. The goals here are: 1. Remove Log4J as a dependency of XContent so that XContent can be used by clients without forcing log4j and our particular deprecation handling scheme. 2. Simplify handling of deprecated fields in tests. Now tests can listen directly for the deprecation callback rather than digging through a ThreadLocal. More accurately, this change begins this work. It deprecates a number of methods, pointing folks to the new versions of those methods that take `DeprecationHandler`. The plan is to slowly drop these deprecated methods. Once they are entirely removed we can remove Log4j as dependency of XContent.
dakrone
approved these changes
Jan 30, 2018
Member
dakrone
left a comment
There was a problem hiding this comment.
This LGTM, I appreciate you breaking it up so it's easier to digest. I left one cosmetic comment
| XContentBuilder builder = XContentBuilder.builder(JsonXContent.jsonXContent).map(config); | ||
| JsonXContentParser parser = new JsonXContentParser(NamedXContentRegistry.EMPTY, | ||
| JSON_FACTORY.createParser(builder.bytes().streamInput())); | ||
| XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, builder.bytes().streamInput()); |
Member
There was a problem hiding this comment.
Why does this one use JsonXContent.jsonXContent.createParser(...) and the one below use XContentType.JSON.xContent().createParser(...) ? They're the same thing so I think we should standardize on one (probably the XContentType one?)
Member
Author
There was a problem hiding this comment.
I suppose because I'm used to the top one and forgot about the bottom one. I'll make them line up.
nik9000
added a commit
that referenced
this pull request
Jan 31, 2018
Factors the way in which XContent parsing handles deprecated fields into a callback that is set at parser construction time. The goals here are: 1. Remove Log4J as a dependency of XContent so that XContent can be used by clients without forcing log4j and our particular deprecation handling scheme. 2. Simplify handling of deprecated fields in tests. Now tests can listen directly for the deprecation callback rather than digging through a ThreadLocal. More accurately, this change begins this work. It deprecates a number of methods, pointing folks to the new versions of those methods that take `DeprecationHandler`. The plan is to slowly drop these deprecated methods. Once they are entirely removed we can remove Log4j as dependency of XContent.
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Feb 1, 2018
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the logging deprecation handler. Relates to elastic#28449
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Feb 1, 2018
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to elastic#28449
dakrone
added a commit
that referenced
this pull request
Feb 2, 2018
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to #28449
dakrone
added a commit
that referenced
this pull request
Feb 2, 2018
This commit switches all the modules and server test code to use the non-deprecated `ParseField.match` method, passing in the parser's deprecation handler or the logging deprecation handler when a parser is not available (like in tests). Relates to #28449
dakrone
added a commit
to dakrone/elasticsearch
that referenced
this pull request
Feb 2, 2018
This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to elastic#28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType.
4 tasks
dakrone
added a commit
that referenced
this pull request
Feb 5, 2018
* Move to non-deprecated XContentHelper.createParser(...) This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to #28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType. * Remove the deprecated (and now non-needed) createParser method
dakrone
added a commit
that referenced
this pull request
Feb 5, 2018
* Move to non-deprecated XContentHelper.createParser(...) This moves away from one of the now-deprecated XContentHelper.createParser methods in favor of specifying the deprecation logger at parser creation time. Relates to #28449 Note that this doesn't move all the `createParser` calls because some of them use the already-deprecated method that doesn't specify the XContentType. * Remove the deprecated (and now non-needed) createParser method
Collaborator
|
Pinging @elastic/es-core-infra |
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.
Factors the way in which XContent parsing handles deprecated fields
into a callback that is set at parser construction time. The goals here
are:
by clients without forcing log4j and our particular deprecation handling
scheme.
directly for the deprecation callback rather than digging through a
ThreadLocal.
More accurately, this change begins this work. It deprecates a number of
methods, pointing folks to the new versions of those methods that take
DeprecationHandler. The plan is to slowly drop these deprecatedmethods. Once they are entirely removed we can remove Log4j as
dependency of XContent.
Replaces #27955.