-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Move more XContent.createParser calls to non-deprecated version #28672
Conversation
Part 2 This moves more of the callers to pass in the DeprecationHandler. Relates to elastic#28504
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same deal as the other one. I think there are a few small things.
@@ -89,7 +90,8 @@ private XContentParser extractRequestSpecificFields(RestRequest restRequest, | |||
consumer.getValue().accept(value); | |||
} | |||
} | |||
return parser.contentType().xContent().createParser(parser.getXContentRegistry(), builder.map(body).bytes()); | |||
return parser.contentType().xContent().createParser(parser.getXContentRegistry(), | |||
LoggingDeprecationHandler.INSTANCE, builder.map(body).bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser.getDeprecationHandler()
?
@@ -73,7 +74,8 @@ | |||
request.setRemoteInfo(buildRemoteInfo(source)); | |||
XContentBuilder builder = XContentFactory.contentBuilder(parser.contentType()); | |||
builder.map(source); | |||
try (XContentParser innerParser = parser.contentType().xContent().createParser(parser.getXContentRegistry(), builder.bytes())) { | |||
try (XContentParser innerParser = parser.contentType().xContent() | |||
.createParser(parser.getXContentRegistry(), LoggingDeprecationHandler.INSTANCE, builder.bytes())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
@@ -336,7 +337,8 @@ protected void finishHim(Exception failure, List<Failure> indexingFailures, List | |||
final XContentType mainRequestXContentType = mainRequest.getDestination().getContentType(); | |||
if (mainRequestXContentType != null && doc.getXContentType() != mainRequestXContentType) { | |||
// we need to convert | |||
try (XContentParser parser = sourceXContentType.xContent().createParser(NamedXContentRegistry.EMPTY, doc.getSource()); | |||
try (XContentParser parser = sourceXContentType.xContent() | |||
.createParser(NamedXContentRegistry.EMPTY, LoggingDeprecationHandler.INSTANCE, doc.getSource()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can make this the throwing one because we just copy the structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah think so, since there isn't such a think as a deprecated field in the body of a document
Thanks again, I pushed another commit |
* Move more XContent.createParser calls to non-deprecated version Part 2 This moves more of the callers to pass in the DeprecationHandler. Relates to #28504 * Use parser's deprecation handler where appropriate * Use logging handler in test that uses deprecated field on purpose
* master: Backported synced-flush PR to v5.6.8 and v6.2.2 Move more XContent.createParser calls to non-deprecated version (elastic#28672) Move more XContent.createParser calls to non-deprecated version (elastic#28670) Build: Group archive and package distribution projects (elastic#28673) [DOCS] Add supported token filters [TEST] bump timeout in testFetchShardsSkipUnavailable to 5s Relax remote check for bwc project checkouts (elastic#28666) [TEST] Synchronize searcher list in IndexShardTests [TEST] packaging: function to collect debug info (elastic#28608) Compute declared versions in a static block Docs: Remove references to elasticsearch directory in plugins (elastic#28647) Remove snapshot conditional for bwc snapshots (elastic#28657) Removed redundant JSON object from Put Mapping docs (elastic#28514) Update threadpool.asciidoc target_response_time (elastic#28655)
Part 2
This moves more of the callers to pass in the DeprecationHandler.
Relates to #28504