Skip to content

Commit

Permalink
Remove warnings (#134)
Browse files Browse the repository at this point in the history
Minor changes for warnings removal.

NamedWriteableRegistryAPI
  remove unused local variables
  remove unused imports

SDKClient
  remove unused private attribute
  remove unsed imports

TransportActions
  add missing diamond operators

TestNamedWriteableRegistryAPI
  remove unused constructor

There are still missing generic declaration on Class<> attributes and
variables, which cannot be fixed only through sdk project, as they are
used as method parameters from classes that do not belong to sdk project
and would require changes on these classes as well.

fix #130

Signed-off-by: Lucas Faria e Souza Vilela <[email protected]>

Signed-off-by: Lucas Faria e Souza Vilela <[email protected]>
  • Loading branch information
lucasfsvilela authored Sep 13, 2022
1 parent f6b057f commit 09ce2fc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
import java.util.List;
import java.util.Map;

import org.opensearch.extensions.OpenSearchRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.common.io.stream.InputStreamStreamInput;
import org.opensearch.common.io.stream.NamedWriteable;
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
import org.opensearch.common.io.stream.NamedWriteableRegistryParseRequest;
import org.opensearch.extensions.ExtensionBooleanResponse;
import org.opensearch.common.io.stream.NamedWriteableRegistryResponse;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.extensions.ExtensionBooleanResponse;
import org.opensearch.extensions.OpenSearchRequest;

/**
* API used to handle named writeable registry requests from OpenSearch
Expand Down Expand Up @@ -122,7 +121,7 @@ public ExtensionBooleanResponse handleNamedWriteableRegistryParseRequest(NamedWr
try {

// TODO : Determine how extensions utilize parsed object (https://github.com/opensearch-project/OpenSearch/issues/4067)
NamedWriteable namedWriteable = streamInput.readNamedWriteable(categoryClass);
streamInput.readNamedWriteable(categoryClass);
status = true;
} catch (UnsupportedOperationException e) {
logger.info("Failed to parse named writeable", e);
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/opensearch/sdk/SDKClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import java.io.IOException;

import org.apache.http.HttpHost;

import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.RestClient;
import org.opensearch.client.RestClientBuilder;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;
Expand All @@ -25,7 +22,6 @@
* This class creates SDKClient for an extension to make requests to OpenSearch
*/
public class SDKClient {
private final Logger logger = LogManager.getLogger(SDKClient.class);
private OpenSearchClient javaClient;
private RestClient restClient = null;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/opensearch/sdk/TransportActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TransportActions {
public <Request extends ActionRequest, Response extends ActionResponse> TransportActions(
Map<String, Class<? extends TransportAction<Request, Response>>> transportActions
) {
this.transportActions = new HashMap(transportActions);
this.transportActions = new HashMap<>(transportActions);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ private static class Example implements NamedWriteable {
public static final String NAME = "example";
private final String message;

Example(String message) {
this.message = message;
}

Example(StreamInput in) throws IOException {
this.message = in.readString();
}
Expand Down

0 comments on commit 09ce2fc

Please sign in to comment.