Skip to content

Commit

Permalink
Switch from XContentType to MediaType to fix compilation errors (#366)
Browse files Browse the repository at this point in the history
Signed-off-by: Heemin Kim <heemin@amazon.com>
  • Loading branch information
heemin32 authored Jul 25, 2023
1 parent 0cd9153 commit 16bace5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import org.opensearch.client.node.NodeClient;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.geospatial.action.upload.geojson.UploadGeoJSONAction;
import org.opensearch.geospatial.action.upload.geojson.UploadGeoJSONRequest;
import org.opensearch.rest.BaseRestHandler;
Expand Down Expand Up @@ -84,7 +84,7 @@ public List<Route> routes() {

@Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) {
Tuple<XContentType, BytesReference> sourceTuple = restRequest.contentOrSourceParam();
Tuple<MediaType, BytesReference> sourceTuple = restRequest.contentOrSourceParam();
RestRequest.Method method = restRequest.getHttpRequest().method();
UploadGeoJSONRequest request = new UploadGeoJSONRequest(method, sourceTuple.v2());
return channel -> client.execute(UploadGeoJSONAction.INSTANCE, request, new RestToXContentListener<>(channel));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.xcontent.DeprecationHandler;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.test.rest.OpenSearchRestTestCase;
Expand Down Expand Up @@ -151,9 +151,9 @@ protected boolean preserveIndicesUponCompletion() {
@After
public void deleteExternalIndices() throws IOException {
Response response = client().performRequest(new Request("GET", "/_cat/indices?format=json&expand_wildcards=all"));
XContentType xContentType = XContentType.fromMediaType(response.getEntity().getContentType());
MediaType mediaType = MediaType.fromMediaType(response.getEntity().getContentType());
try (
XContentParser parser = xContentType.xContent()
XContentParser parser = mediaType.xContent()
.createParser(
NamedXContentRegistry.EMPTY,
DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
Expand Down

0 comments on commit 16bace5

Please sign in to comment.