You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/06/13 00:07:18 UTC
[lucene-solr] branch branch_8x updated: SOLR-14565: Fix or suppress
warnings in solrj/impl and solrj/io/graph
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new a23dd8f SOLR-14565: Fix or suppress warnings in solrj/impl and solrj/io/graph
a23dd8f is described below
commit a23dd8f4feb8d1fc80c681def7c5580eefe2026d
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Fri Jun 12 19:58:40 2020 -0400
SOLR-14565: Fix or suppress warnings in solrj/impl and solrj/io/graph
---
solr/CHANGES.txt | 2 ++
.../client/solrj/impl/BaseCloudSolrClient.java | 17 +++++++---
.../solrj/impl/BaseHttpClusterStateProvider.java | 4 ++-
.../solr/client/solrj/impl/BaseHttpSolrClient.java | 6 ++--
.../client/solrj/impl/BinaryRequestWriter.java | 6 ++--
.../client/solrj/impl/BinaryResponseParser.java | 1 +
.../solr/client/solrj/impl/CloudSolrClient.java | 2 +-
.../client/solrj/impl/ClusterStateProvider.java | 2 ++
.../impl/ConcurrentUpdateHttp2SolrClient.java | 3 +-
.../solrj/impl/ConcurrentUpdateSolrClient.java | 3 +-
.../solrj/impl/DelegationTokenHttpSolrClient.java | 2 +-
.../solrj/impl/Http2ClusterStateProvider.java | 1 +
.../solr/client/solrj/impl/Http2SolrClient.java | 22 ++++++------
.../solrj/impl/HttpClusterStateProvider.java | 1 +
.../solr/client/solrj/impl/HttpSolrClient.java | 26 +++++++++------
.../client/solrj/impl/Krb5HttpClientBuilder.java | 1 +
.../solr/client/solrj/impl/LBHttpSolrClient.java | 4 +--
.../solr/client/solrj/impl/LBSolrClient.java | 15 +++++----
.../client/solrj/impl/SolrClientCloudManager.java | 2 +-
.../solrj/impl/SolrClientNodeStateProvider.java | 4 +++
.../solrj/impl/StreamingBinaryResponseParser.java | 3 ++
.../solrj/impl/ZkClientClusterStateProvider.java | 1 +
.../client/solrj/impl/ZkDistribStateManager.java | 1 +
.../client/solrj/io/graph/GatherNodesStream.java | 39 ++++++++++++----------
.../apache/solr/client/solrj/io/graph/Node.java | 4 +--
.../client/solrj/io/graph/ShortestPathStream.java | 21 ++++++------
.../solr/client/solrj/io/graph/Traversal.java | 11 +++---
.../client/solrj/io/graph/TraversalIterator.java | 9 ++---
.../client/solrj/response/HealthCheckResponse.java | 1 +
29 files changed, 133 insertions(+), 81 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e2010a7..8c8956c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -261,6 +261,8 @@ Other Changes
* SOLR-14563: Fix or suppress warnings in solr/contrib (Erick Erickson)
+* SOLR-14565: Fix or suppress warnings in solrj/impl and solrj/io/graph (Erick Erickson)
+
================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
index 73dc6c1..6dcf4cb 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
@@ -463,6 +463,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
assertZKStateProvider().zkStateReader.registerDocCollectionWatcher(collection, watcher);
}
+ @SuppressWarnings({"unchecked"})
private NamedList<Object> directUpdate(AbstractUpdateRequest request, String collection) throws SolrServerException {
UpdateRequest updateRequest = (UpdateRequest) request;
SolrParams params = request.getParams();
@@ -522,6 +523,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
}
final NamedList<Throwable> exceptions = new NamedList<>();
+ @SuppressWarnings({"rawtypes"})
final NamedList<NamedList> shardResponses = new NamedList<>(routes.size()+1); // +1 for deleteQuery
long start = System.nanoTime();
@@ -612,6 +614,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
long end = System.nanoTime();
+ @SuppressWarnings({"rawtypes"})
RouteResponse rr = condenseResponse(shardResponses, (int) TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS));
rr.setRouteResponses(shardResponses);
rr.setRoutes(routes);
@@ -670,6 +673,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
return urlMap;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected <T extends RouteResponse> T condenseResponse(NamedList response, int timeMillis, Supplier<T> supplier) {
T condensed = supplier.get();
int status = 0;
@@ -766,10 +770,12 @@ public abstract class BaseCloudSolrClient extends SolrClient {
return condensed;
}
+ @SuppressWarnings({"rawtypes"})
public RouteResponse condenseResponse(NamedList response, int timeMillis) {
return condenseResponse(response, timeMillis, RouteResponse::new);
}
+ @SuppressWarnings({"rawtypes"})
public static class RouteResponse<T extends LBSolrClient.Req> extends NamedList {
private NamedList routeResponses;
private Map<String, T> routes;
@@ -829,7 +835,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
}
@Override
- public NamedList<Object> request(SolrRequest request, String collection) throws SolrServerException, IOException {
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})SolrRequest request, String collection) throws SolrServerException, IOException {
// the collection parameter of the request overrides that of the parameter to this method
String requestCollection = request.getCollection();
if (requestCollection != null) {
@@ -847,7 +853,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
* there's a chance that the request will fail due to cached stale state,
* which means the state must be refreshed from ZK and retried.
*/
- protected NamedList<Object> requestWithRetryOnStaleState(SolrRequest request, int retryCount, List<String> inputCollections)
+ protected NamedList<Object> requestWithRetryOnStaleState(@SuppressWarnings({"rawtypes"})SolrRequest request, int retryCount, List<String> inputCollections)
throws SolrServerException, IOException {
connect(); // important to call this before you start working with the ZkStateReader
@@ -913,8 +919,10 @@ public abstract class BaseCloudSolrClient extends SolrClient {
if(o != null && o instanceof Map) {
//remove this because no one else needs this and tests would fail if they are comparing responses
resp.remove(resp.size()-1);
+ @SuppressWarnings({"rawtypes"})
Map invalidStates = (Map) o;
for (Object invalidEntries : invalidStates.entrySet()) {
+ @SuppressWarnings({"rawtypes"})
Map.Entry e = (Map.Entry) invalidEntries;
getDocCollection((String) e.getKey(), (Integer) e.getValue());
}
@@ -1032,7 +1040,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
return resp;
}
- protected NamedList<Object> sendRequest(SolrRequest request, List<String> inputCollections)
+ protected NamedList<Object> sendRequest(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> inputCollections)
throws SolrServerException, IOException {
connect();
@@ -1207,6 +1215,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
//it is readily available just return it
return ref.get();
}
+ @SuppressWarnings({"rawtypes"})
List locks = this.locks;
final Object lock = locks.get(Math.abs(Hash.murmurhash3_x86_32(collection, 0, collection.length(), 0) % locks.size()));
DocCollection fetchedCol = null;
@@ -1265,7 +1274,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
* the replication factor that was achieved in each shard involved in the request.
* For single doc updates, there will be only one shard in the return value.
*/
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String,Integer> getShardReplicationFactor(String collection, NamedList resp) {
connect();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
index 4248212..4694fd5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
import static org.apache.solr.client.solrj.impl.BaseHttpSolrClient.*;
+@SuppressWarnings({"unchecked"})
public abstract class BaseHttpClusterStateProvider implements ClusterStateProvider {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -108,7 +109,7 @@ public abstract class BaseHttpClusterStateProvider implements ClusterStateProvid
+ " solrUrl(s) or zkHost(s).");
}
- @SuppressWarnings({"rawtypes", "unchecked"})
+ @SuppressWarnings({"rawtypes"})
private ClusterState fetchClusterState(SolrClient client, String collection, Map<String, Object> clusterProperties) throws SolrServerException, IOException, NotACollectionException {
ModifiableSolrParams params = new ModifiableSolrParams();
if (collection != null) {
@@ -180,6 +181,7 @@ public abstract class BaseHttpClusterStateProvider implements ClusterStateProvid
}
}
+ @SuppressWarnings({"rawtypes"})
private static Set<String> fetchLiveNodes(SolrClient client) throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("action", "CLUSTERSTATUS");
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java
index dceb13c..f6c9071 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpSolrClient.java
@@ -49,15 +49,16 @@ public abstract class BaseHttpSolrClient extends SolrClient {
* it sends a proper payload back to the client
*/
public static class RemoteExecutionException extends HttpSolrClient.RemoteSolrException {
+ @SuppressWarnings({"rawtypes"})
private NamedList meta;
- public RemoteExecutionException(String remoteHost, int code, String msg, NamedList meta) {
+ public RemoteExecutionException(String remoteHost, int code, String msg, @SuppressWarnings({"rawtypes"})NamedList meta) {
super(remoteHost, code, msg, null);
this.meta = meta;
}
- public static HttpSolrClient.RemoteExecutionException create(String host, NamedList errResponse) {
+ public static HttpSolrClient.RemoteExecutionException create(String host, @SuppressWarnings({"rawtypes"})NamedList errResponse) {
Object errObj = errResponse.get("error");
if (errObj != null) {
Number code = (Number) getObjectByPath(errObj, true, Collections.singletonList("code"));
@@ -71,6 +72,7 @@ public abstract class BaseHttpSolrClient extends SolrClient {
}
+ @SuppressWarnings({"rawtypes"})
public NamedList getMetaData() {
return meta;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
index 542c876..9906ddf 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
@@ -39,7 +39,7 @@ import static org.apache.solr.common.params.CommonParams.JAVABIN_MIME;
public class BinaryRequestWriter extends RequestWriter {
@Override
- public ContentWriter getContentWriter(SolrRequest req) {
+ public ContentWriter getContentWriter(@SuppressWarnings({"rawtypes"})SolrRequest req) {
if (req instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) req;
if (isEmpty(updateRequest)) return null;
@@ -60,7 +60,7 @@ public class BinaryRequestWriter extends RequestWriter {
}
@Override
- public Collection<ContentStream> getContentStreams(SolrRequest req) throws IOException {
+ public Collection<ContentStream> getContentStreams(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {
if (req instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) req;
if (isEmpty(updateRequest) ) return null;
@@ -77,7 +77,7 @@ public class BinaryRequestWriter extends RequestWriter {
}
@Override
- public void write(SolrRequest request, OutputStream os) throws IOException {
+ public void write(@SuppressWarnings({"rawtypes"})SolrRequest request, OutputStream os) throws IOException {
if (request instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) request;
new JavaBinUpdateRequestCodec().marshal(updateRequest, os);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryResponseParser.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryResponseParser.java
index e033abb..b146dcd 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryResponseParser.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryResponseParser.java
@@ -45,6 +45,7 @@ public class BinaryResponseParser extends ResponseParser {
}
@Override
+ @SuppressWarnings({"unchecked"})
public NamedList<Object> processResponse(InputStream body, String encoding) {
try {
return (NamedList<Object>) createCodec().unmarshal(body);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
index 24748ca..cb9e7c2 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
@@ -135,7 +135,7 @@ public class CloudSolrClient extends BaseCloudSolrClient {
* @deprecated since Solr 8.0
*/
@Deprecated
- public RouteResponse condenseResponse(NamedList response, int timeMillis) {
+ public RouteResponse condenseResponse(@SuppressWarnings({"rawtypes"})NamedList response, int timeMillis) {
return condenseResponse(response, timeMillis, RouteResponse::new);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
index a7ce278..fcd9e29 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
@@ -89,6 +89,7 @@ public interface ClusterStateProvider extends SolrCloseable {
* Obtain a cluster property, or the default value if it doesn't exist.
*/
default <T> T getClusterProperty(String key, T defaultValue) {
+ @SuppressWarnings({"unchecked"})
T value = (T) getClusterProperties().get(key);
if (value == null)
return defaultValue;
@@ -98,6 +99,7 @@ public interface ClusterStateProvider extends SolrCloseable {
/**
* Obtain a cluster property, or null if it doesn't exist.
*/
+ @SuppressWarnings({"unchecked"})
default <T> T getClusterProperty(String propertyName) {
return (T) getClusterProperties().get(propertyName);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
index 217e607..1e28c7a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
@@ -209,6 +209,7 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
// Pull from the queue multiple times and streams over a single connection.
// Exits on exception, interruption, or an empty queue to pull from.
//
+ @SuppressWarnings({"unchecked"})
void sendUpdateStream() throws Exception {
try {
@@ -351,7 +352,7 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
}
@Override
- public NamedList<Object> request(final SolrRequest request, String collection)
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)
throws SolrServerException, IOException {
if (!(request instanceof UpdateRequest)) {
request.setBasePath(basePath);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
index 425e194..65ff860 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
@@ -171,6 +171,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
/**
* Opens a connection and sends everything...
*/
+ @SuppressWarnings({"unchecked"})
class Runner implements Runnable {
volatile Thread thread = null;
volatile boolean inPoll = false;
@@ -481,7 +482,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
}
@Override
- public NamedList<Object> request(final SolrRequest request, String collection)
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)
throws SolrServerException, IOException {
if (!(request instanceof UpdateRequest)) {
return client.request(request, collection);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java
index af06faa..c5b7ae5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/DelegationTokenHttpSolrClient.java
@@ -88,7 +88,7 @@ public class DelegationTokenHttpSolrClient extends HttpSolrClient {
}
@Override
- protected HttpRequestBase createMethod(final SolrRequest request, String collection) throws IOException, SolrServerException {
+ protected HttpRequestBase createMethod(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection) throws IOException, SolrServerException {
SolrParams params = request.getParams();
if (params != null && params.getParams(DELEGATION_TOKEN_PARAM) != null) {
throw new IllegalArgumentException(DELEGATION_TOKEN_PARAM + " parameter not supported");
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2ClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2ClusterStateProvider.java
index 335684a..1f801c9 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2ClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2ClusterStateProvider.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.solr.client.solrj.SolrClient;
+@SuppressWarnings({"unchecked"})
public class Http2ClusterStateProvider extends BaseHttpClusterStateProvider {
final Http2SolrClient httpClient;
final boolean closeClient;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 8034083..6f09278 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -245,7 +245,7 @@ public class Http2SolrClient extends SolrClient {
assert ObjectReleaseTracker.release(this);
}
- public boolean isV2ApiRequest(final SolrRequest request) {
+ public boolean isV2ApiRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request) {
return request instanceof V2Request || request.getPath().contains("/____v2");
}
@@ -269,7 +269,7 @@ public class Http2SolrClient extends SolrClient {
this.isXml = isXml;
}
- boolean belongToThisStream(SolrRequest solrRequest, String collection) {
+ boolean belongToThisStream(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection) {
ModifiableSolrParams solrParams = new ModifiableSolrParams(solrRequest.getParams());
if (!origParams.toNamedList().equals(solrParams.toNamedList()) || !StringUtils.equals(origCollection, collection)) {
return false;
@@ -337,7 +337,7 @@ public class Http2SolrClient extends SolrClient {
return outStream;
}
- public void send(OutStream outStream, SolrRequest req, String collection) throws IOException {
+ public void send(OutStream outStream, @SuppressWarnings({"rawtypes"})SolrRequest req, String collection) throws IOException {
assert outStream.belongToThisStream(req, collection);
this.requestWriter.write(req, outStream.outProvider.getOutputStream());
if (outStream.isXml) {
@@ -362,7 +362,7 @@ public class Http2SolrClient extends SolrClient {
outStream.flush();
}
- public NamedList<Object> request(SolrRequest solrRequest,
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest,
String collection,
OnComplete onComplete) throws IOException, SolrServerException {
Request req = makeRequest(solrRequest, collection);
@@ -437,7 +437,7 @@ public class Http2SolrClient extends SolrClient {
return StringUtils.isEmpty(contentType)? null : ContentType.parse(contentType);
}
- private void setBasicAuthHeader(SolrRequest solrRequest, Request req) {
+ private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, Request req) {
if (solrRequest.getBasicAuthUser() != null && solrRequest.getBasicAuthPassword() != null) {
String userPass = solrRequest.getBasicAuthUser() + ":" + solrRequest.getBasicAuthPassword();
String encoded = Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET));
@@ -445,14 +445,14 @@ public class Http2SolrClient extends SolrClient {
}
}
- private Request makeRequest(SolrRequest solrRequest, String collection)
+ private Request makeRequest(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection)
throws SolrServerException, IOException {
Request req = createRequest(solrRequest, collection);
decorateRequest(req, solrRequest);
return req;
}
- private void decorateRequest(Request req, SolrRequest solrRequest) {
+ private void decorateRequest(Request req, @SuppressWarnings({"rawtypes"})SolrRequest solrRequest) {
req.header(HttpHeader.ACCEPT_ENCODING, null);
if (solrRequest.getUserPrincipal() != null) {
req.attribute(REQ_PRINCIPAL_KEY, solrRequest.getUserPrincipal());
@@ -466,6 +466,7 @@ public class Http2SolrClient extends SolrClient {
req.onComplete(listener);
}
+ @SuppressWarnings({"unchecked"})
Map<String, String> headers = solrRequest.getHeaders();
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
@@ -480,7 +481,8 @@ public class Http2SolrClient extends SolrClient {
return new URL(oldURL.getProtocol(), oldURL.getHost(), oldURL.getPort(), newPath).toString();
}
- private Request createRequest(SolrRequest solrRequest, String collection) throws IOException, SolrServerException {
+ @SuppressWarnings({"unchecked"})
+ private Request createRequest(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, String collection) throws IOException, SolrServerException {
if (solrRequest.getBasePath() == null && serverBaseUrl == null)
throw new IllegalArgumentException("Destination node is not provided!");
@@ -631,7 +633,7 @@ public class Http2SolrClient extends SolrClient {
return processor == null || processor instanceof InputStreamResponseParser;
}
- @SuppressWarnings({"unchecked"})
+ @SuppressWarnings({"unchecked", "rawtypes"})
private NamedList<Object> processErrorsAndResponse(Response response,
final ResponseParser processor,
InputStream is,
@@ -755,7 +757,7 @@ public class Http2SolrClient extends SolrClient {
}
@Override
- public NamedList<Object> request(SolrRequest request, String collection) throws SolrServerException, IOException {
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})SolrRequest request, String collection) throws SolrServerException, IOException {
return request(request, collection, null);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
index 07fd8f8..947e4e7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClusterStateProvider.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.http.client.HttpClient;
import org.apache.solr.client.solrj.SolrClient;
+@SuppressWarnings({"unchecked"})
public class HttpClusterStateProvider extends BaseHttpClusterStateProvider {
private final HttpClient httpClient;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
index da6326d..04f2f26 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
@@ -239,7 +239,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {
* org.apache.solr.client.solrj.ResponseParser)
*/
@Override
- public NamedList<Object> request(final SolrRequest request, String collection)
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)
throws SolrServerException, IOException {
ResponseParser responseParser = request.getResponseParser();
if (responseParser == null) {
@@ -248,15 +248,16 @@ public class HttpSolrClient extends BaseHttpSolrClient {
return request(request, responseParser, collection);
}
- public NamedList<Object> request(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
return request(request, processor, null);
}
- public NamedList<Object> request(final SolrRequest request, final ResponseParser processor, String collection)
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor, String collection)
throws SolrServerException, IOException {
HttpRequestBase method = createMethod(request, collection);
setBasicAuthHeader(request, method);
if (request.getHeaders() != null) {
+ @SuppressWarnings({"unchecked"})
Map<String, String> headers = request.getHeaders();
for (Map.Entry<String, String> entry : headers.entrySet()) {
method.setHeader(entry.getKey(), entry.getValue());
@@ -265,11 +266,11 @@ public class HttpSolrClient extends BaseHttpSolrClient {
return executeMethod(method, request.getUserPrincipal(), processor, isV2ApiRequest(request));
}
- private boolean isV2ApiRequest(final SolrRequest request) {
+ private boolean isV2ApiRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request) {
return request instanceof V2Request || request.getPath().contains("/____v2");
}
- private void setBasicAuthHeader(SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException {
+ private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException {
if (request.getBasicAuthUser() != null && request.getBasicAuthPassword() != null) {
String userPass = request.getBasicAuthUser() + ":" + request.getBasicAuthPassword();
String encoded = Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET));
@@ -288,7 +289,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {
/**
* @lucene.experimental
*/
- public HttpUriRequestResponse httpUriRequest(final SolrRequest request)
+ public HttpUriRequestResponse httpUriRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request)
throws SolrServerException, IOException {
ResponseParser responseParser = request.getResponseParser();
if (responseParser == null) {
@@ -300,7 +301,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {
/**
* @lucene.experimental
*/
- public HttpUriRequestResponse httpUriRequest(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
+ public HttpUriRequestResponse httpUriRequest(@SuppressWarnings({"rawtypes"})final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
HttpUriRequestResponse mrr = new HttpUriRequestResponse();
final HttpRequestBase method = createMethod(request, null);
ExecutorService pool = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrNamedThreadFactory("httpUriRequest"));
@@ -340,7 +341,8 @@ public class HttpSolrClient extends BaseHttpSolrClient {
return new URL(oldURL.getProtocol(), oldURL.getHost(), oldURL.getPort(), newPath).toString();
}
- protected HttpRequestBase createMethod(SolrRequest request, String collection) throws IOException, SolrServerException {
+ @SuppressWarnings({"unchecked"})
+ protected HttpRequestBase createMethod(@SuppressWarnings({"rawtypes"})SolrRequest request, String collection) throws IOException, SolrServerException {
if (request instanceof V2RequestSupport) {
request = ((V2RequestSupport) request).getV2Request();
}
@@ -474,7 +476,11 @@ public class HttpSolrClient extends BaseHttpSolrClient {
}
- private HttpEntityEnclosingRequestBase fillContentStream(SolrRequest request, Collection<ContentStream> streams, ModifiableSolrParams wparams, boolean isMultipart, LinkedList<NameValuePair> postOrPutParams, String fullQueryUrl) throws IOException {
+ private HttpEntityEnclosingRequestBase fillContentStream(
+ @SuppressWarnings({"rawtypes"})SolrRequest request,
+ Collection<ContentStream> streams, ModifiableSolrParams wparams,
+ boolean isMultipart, LinkedList<NameValuePair> postOrPutParams,
+ String fullQueryUrl) throws IOException {
HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod() ?
new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);
@@ -533,7 +539,7 @@ public class HttpSolrClient extends BaseHttpSolrClient {
private static final List<String> errPath = Arrays.asList("metadata", "error-class");//Utils.getObjectByPath(err, false,"metadata/error-class")
- @SuppressWarnings({"unchecked"})
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected NamedList<Object> executeMethod(HttpRequestBase method, Principal userPrincipal, final ResponseParser processor, final boolean isV2Api) throws SolrServerException {
method.addHeader("User-Agent", AGENT);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
index a6b1217..6c4b44a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Krb5HttpClientBuilder.java
@@ -208,6 +208,7 @@ public class Krb5HttpClientBuilder implements HttpClientBuilderFactory {
private javax.security.auth.login.Configuration baseConfig;
// the com.sun.security.jgss appNames
+ @SuppressWarnings({"unchecked", "rawtypes"})
private Set<String> initiateAppNames = new HashSet(
Arrays.asList("com.sun.security.jgss.krb5.initiate", "com.sun.security.jgss.initiate"));
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
index 63add2c..bc4efbb 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
@@ -80,11 +80,11 @@ public class LBHttpSolrClient extends LBSolrClient {
*/
@Deprecated
public static class Req extends LBSolrClient.Req {
- public Req(SolrRequest request, List<String> servers) {
+ public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers) {
super(request, servers);
}
- public Req(SolrRequest request, List<String> servers, Integer numServersToTry) {
+ public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers, Integer numServersToTry) {
super(request, servers, numServersToTry);
}
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
index ba48c4c..1b4d464 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
@@ -138,22 +138,24 @@ public abstract class LBSolrClient extends SolrClient {
public static class Req {
+ @SuppressWarnings({"rawtypes"})
protected SolrRequest request;
protected List<String> servers;
protected int numDeadServersToTry;
private final Integer numServersToTry;
- public Req(SolrRequest request, List<String> servers) {
+ public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers) {
this(request, servers, null);
}
- public Req(SolrRequest request, List<String> servers, Integer numServersToTry) {
+ public Req(@SuppressWarnings({"rawtypes"})SolrRequest request, List<String> servers, Integer numServersToTry) {
this.request = request;
this.servers = servers;
this.numDeadServersToTry = servers.size();
this.numServersToTry = numServersToTry;
}
+ @SuppressWarnings({"rawtypes"})
public SolrRequest getRequest() {
return request;
}
@@ -349,7 +351,7 @@ public abstract class LBSolrClient extends SolrClient {
/**
* @return time allowed in nanos, returns -1 if no time_allowed is specified.
*/
- private long getTimeAllowedInNanos(final SolrRequest req) {
+ private long getTimeAllowedInNanos(@SuppressWarnings({"rawtypes"})final SolrRequest req) {
SolrParams reqParams = req.getParams();
return reqParams == null ? -1 :
TimeUnit.NANOSECONDS.convert(reqParams.getInt(CommonParams.TIME_ALLOWED, -1), TimeUnit.MILLISECONDS);
@@ -576,12 +578,12 @@ public abstract class LBSolrClient extends SolrClient {
* @throws IOException If there is a low-level I/O error.
*/
@Override
- public NamedList<Object> request(final SolrRequest request, String collection)
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)
throws SolrServerException, IOException {
return request(request, collection, null);
}
- public NamedList<Object> request(final SolrRequest request, String collection,
+ public NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection,
final Integer numServersToTry) throws SolrServerException, IOException {
Exception ex = null;
ServerWrapper[] serverList = aliveServerList;
@@ -678,7 +680,8 @@ public abstract class LBSolrClient extends SolrClient {
* @param request the request will be sent to the picked server
* @return the picked server
*/
- protected ServerWrapper pickServer(ServerWrapper[] aliveServerList, SolrRequest request) {
+ protected ServerWrapper pickServer(ServerWrapper[] aliveServerList,
+ @SuppressWarnings({"rawtypes"})SolrRequest request) {
int count = counter.incrementAndGet() & Integer.MAX_VALUE;
return aliveServerList[count % aliveServerList.length];
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
index 7aacd42..5ad7ff4 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientCloudManager.java
@@ -124,7 +124,7 @@ public class SolrClientCloudManager implements SolrCloudManager {
}
@Override
- public SolrResponse request(SolrRequest req) throws IOException {
+ public SolrResponse request(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {
try {
return req.process(solrClient);
} catch (SolrServerException e) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
index f659806..b27855f 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
@@ -78,6 +78,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
private final CloudSolrClient solrClient;
protected final Map<String, Map<String, Map<String, List<ReplicaInfo>>>> nodeVsCollectionVsShardVsReplicaInfo = new HashMap<>();
private Map<String, Object> snitchSession = new HashMap<>();
+ @SuppressWarnings({"rawtypes"})
private Map<String, Map> nodeVsTags = new HashMap<>();
private Map<String, String> withCollectionsMap = new HashMap<>();
@@ -147,6 +148,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
@Override
public Map<String, Map<String, List<ReplicaInfo>>> getReplicaInfo(String node, Collection<String> keys) {
+ @SuppressWarnings({"unchecked"})
Map<String, Map<String, List<ReplicaInfo>>> result = nodeVsCollectionVsShardVsReplicaInfo.computeIfAbsent(node, Utils.NEW_HASHMAP_FUN);
if (!keys.isEmpty()) {
Map<String, Pair<String, ReplicaInfo>> metricsKeyVsTagReplica = new HashMap<>();
@@ -227,6 +229,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
metricsKeyVsTag.forEach((key, tag) -> {
Object v = Utils.getObjectByPath(frsp.nl, true, Arrays.asList("metrics", key));
if (tag instanceof Function) {
+ @SuppressWarnings({"unchecked"})
Pair<String, Object> p = (Pair<String, Object>) ((Function) tag).apply(v);
ctx.getTags().put(p.first(), p.second());
} else {
@@ -399,6 +402,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
@Override
+ @SuppressWarnings({"rawtypes"})
public Map getZkJson(String path) throws KeeperException, InterruptedException {
return Utils.getJson(zkClientClusterStateProvider.getZkStateReader().getZkClient(), path, true);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java
index 5c41f6b..7560909 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java
@@ -101,6 +101,7 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser {
EntryImpl entry = (EntryImpl) e;
if( !entry.type().isContainer) return;
if (e.isKeyValEntry() && entry.getTag() == Tag._SOLRDOCLST) {
+ @SuppressWarnings({"rawtypes"})
List l = (List) e.metadata();
e.listenContainer(fastCallback.initDocList(
(Long) l.get(0),
@@ -120,6 +121,7 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser {
private EntryListener docListener;
+ @SuppressWarnings({"unchecked"})
private NamedList<Object> streamDocs(InputStream body) {
try (JavaBinCodec codec = new JavaBinCodec() {
@@ -143,6 +145,7 @@ public class StreamingBinaryResponseParser extends BinaryResponseParser {
@Override
public SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException {
SolrDocumentList solrDocs = new SolrDocumentList();
+ @SuppressWarnings({"rawtypes"})
List list = (List) readVal(dis);
solrDocs.setNumFound((Long) list.get(0));
solrDocs.setStart((Long) list.get(1));
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
index 4073496..3020c1a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
@@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@SuppressWarnings({"unchecked"})
public class ZkClientClusterStateProvider implements ClusterStateProvider {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
index e2834db..b15445b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
@@ -181,6 +181,7 @@ public class ZkDistribStateManager implements DistribStateManager {
}
@Override
+ @SuppressWarnings({"unchecked"})
public AutoScalingConfig getAutoScalingConfig(Watcher watcher) throws InterruptedException, IOException {
Map<String, Object> map = new HashMap<>();
Stat stat = new Stat();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
index 702d034..bd1c5c6 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/GatherNodesStream.java
@@ -82,7 +82,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
String traverseFrom,
String traverseTo,
String gather,
- Map queryParams,
+ @SuppressWarnings({"rawtypes"})Map queryParams,
List<Metric> metrics,
boolean trackTraversal,
Set<Traversal.Scatter> scatter,
@@ -115,7 +115,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
}
- Set<Traversal.Scatter> scatter = new HashSet();
+ Set<Traversal.Scatter> scatter = new HashSet<>();
StreamExpressionNamedParameter scatterExpression = factory.getNamedOperand(expression, "scatter");
@@ -169,7 +169,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
}
String[] rootNodes = fields[0].split(",");
- List<String> l = new ArrayList();
+ List<String> l = new ArrayList<>();
for(String n : rootNodes) {
l.add(n.trim());
}
@@ -181,7 +181,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
}
List<StreamExpression> metricExpressions = factory.getExpressionOperandsRepresentingTypes(expression, Expressible.class, Metric.class);
- List<Metric> metrics = new ArrayList();
+ List<Metric> metrics = new ArrayList<>();
for(int idx = 0; idx < metricExpressions.size(); ++idx){
metrics.add(factory.constructMetric(metricExpressions.get(idx)));
}
@@ -245,13 +245,14 @@ public class GatherNodesStream extends TupleStream implements Expressible {
docFreq);
}
+ @SuppressWarnings({"unchecked"})
private void init(String zkHost,
String collection,
TupleStream tupleStream,
String traverseFrom,
String traverseTo,
String gather,
- Map queryParams,
+ @SuppressWarnings({"rawtypes"})Map queryParams,
List<Metric> metrics,
boolean trackTraversal,
Set<Traversal.Scatter> scatter,
@@ -295,7 +296,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
Set<Map.Entry<String,String>> entries = queryParams.entrySet();
// parameters
- for(Map.Entry param : entries){
+ for(@SuppressWarnings({"rawtypes"})Map.Entry param : entries){
String value = param.getValue().toString();
// SOLR-8409: This is a special case where the params contain a " character
@@ -400,7 +401,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
}
public List<TupleStream> children() {
- List<TupleStream> l = new ArrayList();
+ List<TupleStream> l = new ArrayList<>();
l.add(tupleStream);
return l;
}
@@ -409,10 +410,11 @@ public class GatherNodesStream extends TupleStream implements Expressible {
tupleStream.open();
}
+ @SuppressWarnings({"unchecked"})
private class JoinRunner implements Callable<List<Tuple>> {
private List<String> nodes;
- private List<Tuple> edges = new ArrayList();
+ private List<Tuple> edges = new ArrayList<>();
public JoinRunner(List<String> nodes) {
this.nodes = nodes;
@@ -421,7 +423,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
public List<Tuple> call() {
- Set<String> flSet = new HashSet();
+ Set<String> flSet = new HashSet<>();
flSet.add(gather);
flSet.add(traverseTo);
@@ -508,24 +510,26 @@ public class GatherNodesStream extends TupleStream implements Expressible {
tupleStream.close();
}
+ @SuppressWarnings({"unchecked"})
public Tuple read() throws IOException {
if (out == null) {
- List<String> joinBatch = new ArrayList();
- List<Future<List<Tuple>>> futures = new ArrayList();
- Map<String, Node> level = new HashMap();
+ List<String> joinBatch = new ArrayList<>();
+ List<Future<List<Tuple>>> futures = new ArrayList<>();
+ Map<String, Node> level = new HashMap<>();
ExecutorService threadPool = null;
try {
threadPool = ExecutorUtil.newMDCAwareFixedThreadPool(4, new SolrNamedThreadFactory("GatherNodesStream"));
- Map<String, Node> roots = new HashMap();
+ Map<String, Node> roots = new HashMap<>();
while (true) {
Tuple tuple = tupleStream.read();
if (tuple.EOF) {
if (joinBatch.size() > 0) {
JoinRunner joinRunner = new JoinRunner(joinBatch);
+ @SuppressWarnings({"rawtypes"})
Future future = threadPool.submit(joinRunner);
futures.add(future);
}
@@ -541,7 +545,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
if(!roots.containsKey(key)) {
Node node = new Node(value, trackTraversal);
if (metrics != null) {
- List<Metric> _metrics = new ArrayList();
+ List<Metric> _metrics = new ArrayList<>();
for (Metric metric : metrics) {
_metrics.add(metric.newInstance());
}
@@ -557,9 +561,10 @@ public class GatherNodesStream extends TupleStream implements Expressible {
joinBatch.add(value);
if (joinBatch.size() == 400) {
JoinRunner joinRunner = new JoinRunner(joinBatch);
+ @SuppressWarnings({"rawtypes"})
Future future = threadPool.submit(joinRunner);
futures.add(future);
- joinBatch = new ArrayList();
+ joinBatch = new ArrayList<>();
}
}
@@ -588,7 +593,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
} else {
node = new Node(_gather, trackTraversal);
if (metrics != null) {
- List<Metric> _metrics = new ArrayList();
+ List<Metric> _metrics = new ArrayList<>();
for (Metric metric : metrics) {
_metrics.add(metric.newInstance());
}
@@ -638,7 +643,7 @@ public class GatherNodesStream extends TupleStream implements Expressible {
public void open() {this.it = ids.iterator();}
public void close() {}
public StreamComparator getStreamSort() {return null;}
- public List<TupleStream> children() {return new ArrayList();}
+ public List<TupleStream> children() {return new ArrayList<>();}
public void setStreamContext(StreamContext context) {}
public Tuple read() {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Node.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Node.java
index 7c99f75..6b551d7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Node.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Node.java
@@ -30,7 +30,7 @@ public class Node {
public Node(String id, boolean track) {
this.id=id;
if(track) {
- ancestors = new HashSet();
+ ancestors = new HashSet<>();
}
}
@@ -62,7 +62,7 @@ public class Node {
List<String> cols = traversal.getCollections();
if(ancestors != null) {
- List<String> l = new ArrayList();
+ List<String> l = new ArrayList<>();
for(String ancestor : ancestors) {
String[] ancestorParts = ancestor.split("\\^");
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java
index 9d12e48..6f2b8bd 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/ShortestPathStream.java
@@ -68,7 +68,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {
private int maxDepth;
private String zkHost;
private String collection;
- private LinkedList<Tuple> shortestPaths = new LinkedList();
+ private LinkedList<Tuple> shortestPaths = new LinkedList<>();
private boolean found;
private StreamContext streamContext;
private int threads;
@@ -282,20 +282,21 @@ public class ShortestPathStream extends TupleStream implements Expressible {
}
public List<TupleStream> children() {
- List<TupleStream> l = new ArrayList();
+ List<TupleStream> l = new ArrayList<>();
return l;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void open() throws IOException {
- List<Map<String,List<String>>> allVisited = new ArrayList();
+ List<Map<String,List<String>>> allVisited = new ArrayList<>();
Map visited = new HashMap();
visited.put(this.fromNode, null);
allVisited.add(visited);
int depth = 0;
Map<String, List<String>> nextVisited = null;
- List<Edge> targets = new ArrayList();
+ List<Edge> targets = new ArrayList<>();
ExecutorService threadPool = null;
try {
@@ -309,8 +310,8 @@ public class ShortestPathStream extends TupleStream implements Expressible {
Iterator<String> it = nodes.iterator();
nextVisited = new HashMap();
int batchCount = 0;
- List<String> queryNodes = new ArrayList();
- List<Future> futures = new ArrayList();
+ List<String> queryNodes = new ArrayList<>();
+ List<Future> futures = new ArrayList<>();
JOIN:
//Queue up all the batches
while (it.hasNext()) {
@@ -343,7 +344,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {
List<String> parents = nextVisited.get(edge.to);
parents.add(edge.from);
} else {
- List<String> parents = new ArrayList();
+ List<String> parents = new ArrayList<>();
parents.add(edge.from);
nextVisited.put(edge.to, parents);
}
@@ -353,7 +354,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {
List<String> parents = nextVisited.get(edge.to);
parents.add(edge.from);
} else {
- List<String> parents = new ArrayList();
+ List<String> parents = new ArrayList<>();
parents.add(edge.from);
nextVisited.put(edge.to, parents);
}
@@ -376,7 +377,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {
Set<String> finalPaths = new HashSet();
if(targets.size() > 0) {
for(Edge edge : targets) {
- List<LinkedList> paths = new ArrayList();
+ List<LinkedList> paths = new ArrayList<>();
LinkedList<String> path = new LinkedList();
path.addFirst(edge.to);
paths.add(path);
@@ -415,7 +416,7 @@ public class ShortestPathStream extends TupleStream implements Expressible {
private class JoinRunner implements Callable<List<Edge>> {
private List<String> nodes;
- private List<Edge> edges = new ArrayList();
+ private List<Edge> edges = new ArrayList<>();
public JoinRunner(List<String> nodes) {
this.nodes = nodes;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java
index 43d23b3..e5afd4d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/Traversal.java
@@ -22,11 +22,11 @@ import java.util.*;
public class Traversal {
- private List<Map<String, Node>> graph = new ArrayList();
- private List<String> fields = new ArrayList();
- private List<String> collections = new ArrayList();
- private Set<Scatter> scatter = new HashSet();
- private Set<String> collectionSet = new HashSet();
+ private List<Map<String, Node>> graph = new ArrayList<>();
+ private List<String> fields = new ArrayList<>();
+ private List<String> collections = new ArrayList<>();
+ private Set<Scatter> scatter = new HashSet<>();
+ private Set<String> collectionSet = new HashSet<>();
private boolean trackTraversal;
private int depth;
@@ -90,6 +90,7 @@ public class Traversal {
LEAVES;
}
+ @SuppressWarnings({"unchecked"})
public Iterator<Tuple> iterator() {
return new TraversalIterator(this, scatter);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java
index 7cfe375..e2df8d5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/graph/TraversalIterator.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.graph.Traversal.Scatter;
+@SuppressWarnings({"rawtypes"})
class TraversalIterator implements Iterator {
private List<Map<String,Node>> graph;
@@ -49,10 +50,10 @@ class TraversalIterator implements Iterator {
collections = traversal.getCollections();
fields = traversal.getFields();
- List<String> outCollections = new ArrayList();
- List<String> outFields = new ArrayList();
- List<Integer> levelNums = new ArrayList();
- List<Iterator<Node>> levelIterators = new ArrayList();
+ List<String> outCollections = new ArrayList<>();
+ List<String> outFields = new ArrayList<>();
+ List<Integer> levelNums = new ArrayList<>();
+ List<Iterator<Node>> levelIterators = new ArrayList<>();
if(scatter.contains(Scatter.BRANCHES)) {
if(graph.size() > 1) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/HealthCheckResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/HealthCheckResponse.java
index b6fc36b..0b4d4bc 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/HealthCheckResponse.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/HealthCheckResponse.java
@@ -24,6 +24,7 @@ public class HealthCheckResponse extends SolrResponseBase {
public HealthCheckResponse() {
}
+ @SuppressWarnings({"unchecked"})
public NamedList<String> getErrorMessages() {
return (NamedList<String>) getResponse().get( "errors" );
}