SOLR-14567: Fix or suppress remaining warnings in solrj

This commit is contained in:
Erick Erickson 2020-06-14 08:11:23 -04:00
parent 396490b65c
commit 4e90e48ac2
65 changed files with 262 additions and 58 deletions

View File

@ -340,6 +340,8 @@ Other Changes
* SOLR-14564: Fix or suppress remaining warnings in solr/core (Erick Erickson) * SOLR-14564: Fix or suppress remaining warnings in solr/core (Erick Erickson)
* SOLR-14567: Fix or suppress remaining warnings in solrj (Erick Erickson)
================== 8.5.2 ================== ================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -1273,7 +1273,7 @@ public abstract class SolrClient implements Serializable, Closeable {
* @throws IOException If there is a low-level I/O error. * @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server * @throws SolrServerException if there is an error on the server
*/ */
public abstract NamedList<Object> request(final SolrRequest request, String collection) public abstract NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request, String collection)
throws SolrServerException, IOException; throws SolrServerException, IOException;
/** /**
@ -1286,7 +1286,7 @@ public abstract class SolrClient implements Serializable, Closeable {
* @throws IOException If there is a low-level I/O error. * @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server * @throws SolrServerException if there is an error on the server
*/ */
public final NamedList<Object> request(final SolrRequest request) throws SolrServerException, IOException { public final NamedList<Object> request(@SuppressWarnings({"rawtypes"})final SolrRequest request) throws SolrServerException, IOException {
return request(request, null); return request(request, null);
} }

View File

@ -74,6 +74,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl
/**If set to true, every request that implements {@link V2RequestSupport} will be converted /**If set to true, every request that implements {@link V2RequestSupport} will be converted
* to a V2 API call * to a V2 API call
*/ */
@SuppressWarnings({"rawtypes"})
public SolrRequest setUseV2(boolean flag){ public SolrRequest setUseV2(boolean flag){
this.usev2 = flag; this.usev2 = flag;
return this; return this;
@ -81,6 +82,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl
/**If set to true use javabin instead of json (default) /**If set to true use javabin instead of json (default)
*/ */
@SuppressWarnings({"rawtypes"})
public SolrRequest setUseBinaryV2(boolean flag){ public SolrRequest setUseBinaryV2(boolean flag){
this.useBinaryV2 = flag; this.useBinaryV2 = flag;
return this; return this;
@ -90,6 +92,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl
private String basePath; private String basePath;
@SuppressWarnings({"rawtypes"})
public SolrRequest setBasicAuthCredentials(String user, String password) { public SolrRequest setBasicAuthCredentials(String user, String password) {
this.basicAuthUser = user; this.basicAuthUser = user;
this.basicAuthPwd = password; this.basicAuthPwd = password;

View File

@ -55,6 +55,7 @@ public abstract class SolrResponse implements Serializable, MapWriter {
} }
public Exception getException() { public Exception getException() {
@SuppressWarnings({"rawtypes"})
NamedList exp = (NamedList) getResponse().get("exception"); NamedList exp = (NamedList) getResponse().get("exception");
if (exp == null) { if (exp == null) {
return null; return null;

View File

@ -26,5 +26,6 @@ public interface V2RequestSupport {
* return V1 request object * return V1 request object
* *
*/ */
@SuppressWarnings({"rawtypes"})
SolrRequest getV2Request(); SolrRequest getV2Request();
} }

View File

@ -37,6 +37,7 @@ import java.nio.ByteBuffer;
*/ */
public class DocumentObjectBinder { public class DocumentObjectBinder {
@SuppressWarnings({"rawtypes"})
private final Map<Class, List<DocField>> infocache = new ConcurrentHashMap<>(); private final Map<Class, List<DocField>> infocache = new ConcurrentHashMap<>();
public DocumentObjectBinder() { public DocumentObjectBinder() {
@ -83,6 +84,7 @@ public class DocumentObjectBinder {
if (field.dynamicFieldNamePatternMatcher != null && if (field.dynamicFieldNamePatternMatcher != null &&
field.get(obj) != null && field.get(obj) != null &&
field.isContainedInMap) { field.isContainedInMap) {
@SuppressWarnings({"unchecked"})
Map<String, Object> mapValue = (Map<String, Object>) field.get(obj); Map<String, Object> mapValue = (Map<String, Object>) field.get(obj);
for (Map.Entry<String, Object> e : mapValue.entrySet()) { for (Map.Entry<String, Object> e : mapValue.entrySet()) {
@ -103,6 +105,7 @@ public class DocumentObjectBinder {
Object val = field.get(obj); Object val = field.get(obj);
if (val == null) return; if (val == null) return;
if (val instanceof Collection) { if (val instanceof Collection) {
@SuppressWarnings({"rawtypes"})
Collection collection = (Collection) val; Collection collection = (Collection) val;
for (Object o : collection) { for (Object o : collection) {
SolrInputDocument child = toSolrInputDocument(o); SolrInputDocument child = toSolrInputDocument(o);
@ -116,7 +119,7 @@ public class DocumentObjectBinder {
} }
} }
private List<DocField> getDocFields(Class clazz) { private List<DocField> getDocFields(@SuppressWarnings({"rawtypes"})Class clazz) {
List<DocField> fields = infocache.get(clazz); List<DocField> fields = infocache.get(clazz);
if (fields == null) { if (fields == null) {
synchronized(infocache) { synchronized(infocache) {
@ -127,8 +130,9 @@ public class DocumentObjectBinder {
} }
@SuppressForbidden(reason = "Needs access to possibly private @Field annotated fields/methods") @SuppressForbidden(reason = "Needs access to possibly private @Field annotated fields/methods")
private List<DocField> collectInfo(Class clazz) { private List<DocField> collectInfo(@SuppressWarnings({"rawtypes"})Class clazz) {
List<DocField> fields = new ArrayList<>(); List<DocField> fields = new ArrayList<>();
@SuppressWarnings({"rawtypes"})
Class superClazz = clazz; Class superClazz = clazz;
List<AccessibleObject> members = new ArrayList<>(); List<AccessibleObject> members = new ArrayList<>();
@ -159,6 +163,7 @@ public class DocumentObjectBinder {
private java.lang.reflect.Field field; private java.lang.reflect.Field field;
private Method setter; private Method setter;
private Method getter; private Method getter;
@SuppressWarnings({"rawtypes"})
private Class type; private Class type;
private boolean isArray; private boolean isArray;
private boolean isList; private boolean isList;
@ -230,6 +235,7 @@ public class DocumentObjectBinder {
if (field != null) { if (field != null) {
type = field.getType(); type = field.getType();
} else { } else {
@SuppressWarnings({"rawtypes"})
Class[] params = setter.getParameterTypes(); Class[] params = setter.getParameterTypes();
if (params.length != 1) { if (params.length != 1) {
throw new BindingException("Invalid setter method (" + setter + throw new BindingException("Invalid setter method (" + setter +
@ -325,7 +331,7 @@ public class DocumentObjectBinder {
* Returns <code>SolrDocument.getFieldValue</code> for regular fields, * Returns <code>SolrDocument.getFieldValue</code> for regular fields,
* and <code>Map<String, List<Object>></code> for a dynamic field. The key is all matching fieldName's. * and <code>Map<String, List<Object>></code> for a dynamic field. The key is all matching fieldName's.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
private Object getFieldValue(SolrDocument solrDocument) { private Object getFieldValue(SolrDocument solrDocument) {
if (child != null) { if (child != null) {
List<SolrDocument> children = solrDocument.getChildDocuments(); List<SolrDocument> children = solrDocument.getChildDocuments();
@ -406,6 +412,7 @@ public class DocumentObjectBinder {
} }
} }
@SuppressWarnings({"unchecked", "rawtypes"})
<T> void inject(T obj, SolrDocument sdoc) { <T> void inject(T obj, SolrDocument sdoc) {
Object val = getFieldValue(sdoc); Object val = getFieldValue(sdoc);
if(val == null) { if(val == null) {

View File

@ -48,7 +48,7 @@ public interface SolrCloudManager extends SolrCloseable {
// Solr-like methods // Solr-like methods
SolrResponse request(SolrRequest req) throws IOException; SolrResponse request(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException;
byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String, String> headers, String payload, int timeout, boolean followRedirects) throws IOException; byte[] httpRequest(String url, SolrRequest.METHOD method, Map<String, String> headers, String payload, int timeout, boolean followRedirects) throws IOException;
} }

View File

@ -777,13 +777,15 @@ public abstract class BaseCloudSolrClient extends SolrClient {
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
public static class RouteResponse<T extends LBSolrClient.Req> extends NamedList { public static class RouteResponse<T extends LBSolrClient.Req> extends NamedList {
@SuppressWarnings({"rawtypes"})
private NamedList routeResponses; private NamedList routeResponses;
private Map<String, T> routes; private Map<String, T> routes;
public void setRouteResponses(NamedList routeResponses) { public void setRouteResponses(@SuppressWarnings({"rawtypes"})NamedList routeResponses) {
this.routeResponses = routeResponses; this.routeResponses = routeResponses;
} }
@SuppressWarnings({"rawtypes"})
public NamedList getRouteResponses() { public NamedList getRouteResponses() {
return routeResponses; return routeResponses;
} }
@ -1291,6 +1293,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
} }
} }
@SuppressWarnings({"unchecked"})
Iterator<Map.Entry<String,Object>> routeIter = routes.iterator(); Iterator<Map.Entry<String,Object>> routeIter = routes.iterator();
while (routeIter.hasNext()) { while (routeIter.hasNext()) {
Map.Entry<String,Object> next = routeIter.next(); Map.Entry<String,Object> next = routeIter.next();

View File

@ -226,6 +226,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
// Pull from the queue multiple times and streams over a single connection. // Pull from the queue multiple times and streams over a single connection.
// Exits on exception, interruption, or an empty queue to pull from. // Exits on exception, interruption, or an empty queue to pull from.
// //
@SuppressWarnings({"unchecked"})
void sendUpdateStream() throws Exception { void sendUpdateStream() throws Exception {
while (!queue.isEmpty()) { while (!queue.isEmpty()) {

View File

@ -36,26 +36,28 @@ public class ClassificationEvaluation {
} }
} }
public void putToMap(Map map) { @SuppressWarnings({"unchecked"})
public void putToMap(@SuppressWarnings({"rawtypes"})Map map) {
map.put("truePositive_i",truePositive); map.put("truePositive_i",truePositive);
map.put("trueNegative_i",trueNegative); map.put("trueNegative_i",trueNegative);
map.put("falsePositive_i",falsePositive); map.put("falsePositive_i",falsePositive);
map.put("falseNegative_i",falseNegative); map.put("falseNegative_i",falseNegative);
} }
@SuppressWarnings({"rawtypes"})
public Map toMap() { public Map toMap() {
HashMap map = new HashMap(); HashMap map = new HashMap();
putToMap(map); putToMap(map);
return map; return map;
} }
public static ClassificationEvaluation create(Map map) { public static ClassificationEvaluation create(@SuppressWarnings({"rawtypes"})Map map) {
ClassificationEvaluation evaluation = new ClassificationEvaluation(); ClassificationEvaluation evaluation = new ClassificationEvaluation();
evaluation.addEvaluation(map); evaluation.addEvaluation(map);
return evaluation; return evaluation;
} }
public void addEvaluation(Map map) { public void addEvaluation(@SuppressWarnings({"rawtypes"})Map map) {
this.truePositive += (long) map.get("truePositive_i"); this.truePositive += (long) map.get("truePositive_i");
this.trueNegative += (long) map.get("trueNegative_i"); this.trueNegative += (long) map.get("trueNegative_i");
this.falsePositive += (long) map.get("falsePositive_i"); this.falsePositive += (long) map.get("falsePositive_i");

View File

@ -136,7 +136,7 @@ public class ModelCache {
this.maxSize = maxSize; this.maxSize = maxSize;
} }
public boolean removeEldestEntry(Map.Entry eldest) { public boolean removeEldestEntry(@SuppressWarnings({"rawtypes"})Map.Entry eldest) {
if(size()> maxSize) { if(size()> maxSize) {
return true; return true;
} else { } else {

View File

@ -52,16 +52,19 @@ public class Tuple implements Cloneable, MapWriter {
* Tuple fields. * Tuple fields.
* @deprecated use {@link #getFields()} instead of this public field. * @deprecated use {@link #getFields()} instead of this public field.
*/ */
@Deprecated
public Map<Object, Object> fields = new HashMap<>(2); public Map<Object, Object> fields = new HashMap<>(2);
/** /**
* External serializable field names. * External serializable field names.
* @deprecated use {@link #getFieldNames()} instead of this public field. * @deprecated use {@link #getFieldNames()} instead of this public field.
*/ */
@Deprecated
public List<String> fieldNames; public List<String> fieldNames;
/** /**
* Mapping of external field names to internal tuple field names. * Mapping of external field names to internal tuple field names.
* @deprecated use {@link #getFieldLabels()} instead of this public field. * @deprecated use {@link #getFieldLabels()} instead of this public field.
*/ */
@Deprecated
public Map<String, String> fieldLabels; public Map<String, String> fieldLabels;
public Tuple() { public Tuple() {
@ -151,6 +154,7 @@ public class Tuple implements Cloneable, MapWriter {
} }
} }
@SuppressWarnings({"unchecked"})
public List<Boolean> getBools(Object key) { public List<Boolean> getBools(Object key) {
return (List<Boolean>) this.fields.get(key); return (List<Boolean>) this.fields.get(key);
} }
@ -171,6 +175,7 @@ public class Tuple implements Cloneable, MapWriter {
} }
} }
@SuppressWarnings({"unchecked"})
public List<Date> getDates(Object key) { public List<Date> getDates(Object key) {
List<String> vals = (List<String>) this.fields.get(key); List<String> vals = (List<String>) this.fields.get(key);
if (vals == null) return null; if (vals == null) return null;
@ -197,14 +202,17 @@ public class Tuple implements Cloneable, MapWriter {
} }
} }
@SuppressWarnings({"unchecked"})
public List<String> getStrings(Object key) { public List<String> getStrings(Object key) {
return (List<String>)this.fields.get(key); return (List<String>)this.fields.get(key);
} }
@SuppressWarnings({"unchecked"})
public List<Long> getLongs(Object key) { public List<Long> getLongs(Object key) {
return (List<Long>)this.fields.get(key); return (List<Long>)this.fields.get(key);
} }
@SuppressWarnings({"unchecked"})
public List<Double> getDoubles(Object key) { public List<Double> getDoubles(Object key) {
return (List<Double>)this.fields.get(key); return (List<Double>)this.fields.get(key);
} }
@ -221,6 +229,7 @@ public class Tuple implements Cloneable, MapWriter {
* @deprecated use {@link #getFields()} instead. * @deprecated use {@link #getFields()} instead.
*/ */
@Deprecated(since = "8.6.0") @Deprecated(since = "8.6.0")
@SuppressWarnings({"rawtypes"})
public Map getMap() { public Map getMap() {
return this.fields; return this.fields;
} }
@ -252,18 +261,21 @@ public class Tuple implements Cloneable, MapWriter {
this.fieldNames = fieldNames; this.fieldNames = fieldNames;
} }
@SuppressWarnings({"unchecked", "rawtypes"})
public List<Map> getMaps(Object key) { public List<Map> getMaps(Object key) {
return (List<Map>) this.fields.get(key); return (List<Map>) this.fields.get(key);
} }
public void setMaps(Object key, List<Map> maps) { public void setMaps(Object key, @SuppressWarnings({"rawtypes"})List<Map> maps) {
this.fields.put(key, maps); this.fields.put(key, maps);
} }
@SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Map> getMetrics() { public Map<String, Map> getMetrics() {
return (Map<String, Map>) this.fields.get(StreamParams.METRICS); return (Map<String, Map>) this.fields.get(StreamParams.METRICS);
} }
@SuppressWarnings({"rawtypes"})
public void setMetrics(Map<String, Map> metrics) { public void setMetrics(Map<String, Map> metrics) {
this.fields.put(StreamParams.METRICS, metrics); this.fields.put(StreamParams.METRICS, metrics);
} }

View File

@ -108,10 +108,13 @@ public class FieldComparator implements StreamComparator {
* check only once - we can do that in the constructor of this class, create a lambda, and then execute * check only once - we can do that in the constructor of this class, create a lambda, and then execute
* that lambda in the compare function. A little bit of branch prediction savings right here. * that lambda in the compare function. A little bit of branch prediction savings right here.
*/ */
@SuppressWarnings({"unchecked"})
private void assignComparator(){ private void assignComparator(){
if(ComparatorOrder.DESCENDING == order){ if(ComparatorOrder.DESCENDING == order){
comparator = (leftTuple, rightTuple) -> { comparator = (leftTuple, rightTuple) -> {
@SuppressWarnings({"rawtypes"})
Comparable leftComp = (Comparable)leftTuple.get(leftFieldName); Comparable leftComp = (Comparable)leftTuple.get(leftFieldName);
@SuppressWarnings({"rawtypes"})
Comparable rightComp = (Comparable)rightTuple.get(rightFieldName); Comparable rightComp = (Comparable)rightTuple.get(rightFieldName);
if(leftComp == rightComp){ return 0; } // if both null then they are equal. if both are same ref then are equal if(leftComp == rightComp){ return 0; } // if both null then they are equal. if both are same ref then are equal
@ -124,7 +127,9 @@ public class FieldComparator implements StreamComparator {
else{ else{
// See above for black magic reasoning. // See above for black magic reasoning.
comparator = (leftTuple, rightTuple) -> { comparator = (leftTuple, rightTuple) -> {
@SuppressWarnings({"rawtypes"})
Comparable leftComp = (Comparable)leftTuple.get(leftFieldName); Comparable leftComp = (Comparable)leftTuple.get(leftFieldName);
@SuppressWarnings({"rawtypes"})
Comparable rightComp = (Comparable)rightTuple.get(rightFieldName); Comparable rightComp = (Comparable)rightTuple.get(rightFieldName);
if(leftComp == rightComp){ return 0; } // if both null then they are equal. if both are same ref then are equal if(leftComp == rightComp){ return 0; } // if both null then they are equal. if both are same ref then are equal

View File

@ -73,9 +73,12 @@ public class FieldEqualitor implements StreamEqualitor {
.withExpression(toExpression(factory).toString()); .withExpression(toExpression(factory).toString());
} }
@SuppressWarnings({"unchecked"})
public boolean test(Tuple leftTuple, Tuple rightTuple) { public boolean test(Tuple leftTuple, Tuple rightTuple) {
@SuppressWarnings({"rawtypes"})
Comparable leftComp = (Comparable)leftTuple.get(leftFieldName); Comparable leftComp = (Comparable)leftTuple.get(leftFieldName);
@SuppressWarnings({"rawtypes"})
Comparable rightComp = (Comparable)rightTuple.get(rightFieldName); Comparable rightComp = (Comparable)rightTuple.get(rightFieldName);
if(leftComp == rightComp){ return true; } // if both null then they are equal. if both are same ref then are equal if(leftComp == rightComp){ return true; } // if both null then they are equal. if both are same ref then are equal

View File

@ -46,6 +46,7 @@ public class GroupOperation implements ReduceOperation {
private UUID operationNodeId = UUID.randomUUID(); private UUID operationNodeId = UUID.randomUUID();
private PriorityQueue<Tuple> priorityQueue; private PriorityQueue<Tuple> priorityQueue;
@SuppressWarnings({"rawtypes"})
private Comparator comp; private Comparator comp;
private StreamComparator streamComparator; private StreamComparator streamComparator;
private int size; private int size;
@ -75,6 +76,7 @@ public class GroupOperation implements ReduceOperation {
init(streamComparator, size); init(streamComparator, size);
} }
@SuppressWarnings({"unchecked", "rawtypes"})
private void init(StreamComparator streamComparator, int size) { private void init(StreamComparator streamComparator, int size) {
this.size = size; this.size = size;
this.streamComparator = streamComparator; this.streamComparator = streamComparator;
@ -104,14 +106,18 @@ public class GroupOperation implements ReduceOperation {
}); });
} }
@SuppressWarnings({"unchecked"})
public Tuple reduce() { public Tuple reduce() {
@SuppressWarnings({"rawtypes"})
LinkedList ll = new LinkedList(); LinkedList ll = new LinkedList();
while(priorityQueue.size() > 0) { while(priorityQueue.size() > 0) {
ll.addFirst(priorityQueue.poll().getFields()); ll.addFirst(priorityQueue.poll().getFields());
//This will clear priority queue and so it will be ready for the next group. //This will clear priority queue and so it will be ready for the next group.
} }
List<Map> list = new ArrayList(ll); @SuppressWarnings({"rawtypes"})
List<Map> list = new ArrayList<>(ll);
@SuppressWarnings({"rawtypes"})
Map groupHead = list.get(0); Map groupHead = list.get(0);
Tuple tuple = new Tuple(groupHead); Tuple tuple = new Tuple(groupHead);
tuple.put("group", list); tuple.put("group", list);

View File

@ -35,6 +35,7 @@ class ResultSetMetaDataImpl implements ResultSetMetaData {
this.firstTuple = this.resultSet.getFirstTuple(); this.firstTuple = this.resultSet.getFirstTuple();
} }
@SuppressWarnings({"rawtypes"})
private Class getColumnClass(int column) throws SQLException { private Class getColumnClass(int column) throws SQLException {
Object o = this.firstTuple.get(this.getColumnLabel(column)); Object o = this.firstTuple.get(this.getColumnLabel(column));
if(o == null) { if(o == null) {
@ -90,6 +91,7 @@ class ResultSetMetaDataImpl implements ResultSetMetaData {
@Override @Override
public String getColumnLabel(int column) throws SQLException { public String getColumnLabel(int column) throws SQLException {
@SuppressWarnings({"unchecked"})
Map<String, String> aliases = (Map<String, String>) metadataTuple.get("aliases"); Map<String, String> aliases = (Map<String, String>) metadataTuple.get("aliases");
return aliases.get(this.getColumnName(column)); return aliases.get(this.getColumnName(column));
} }

View File

@ -249,14 +249,17 @@ public class CollectionApiMapping {
} }
Meta(EndPoint endPoint, SolrRequest.METHOD method, CollectionAction action, Meta(EndPoint endPoint, SolrRequest.METHOD method, CollectionAction action,
String commandName, Map paramsToAttrs) { String commandName,
@SuppressWarnings({"rawtypes"})Map paramsToAttrs) {
this(endPoint, method, action, commandName, paramsToAttrs, Collections.emptyMap()); this(endPoint, method, action, commandName, paramsToAttrs, Collections.emptyMap());
} }
// lame... the Maps aren't typed simply because callers want to use Utils.makeMap which yields object vals // lame... the Maps aren't typed simply because callers want to use Utils.makeMap which yields object vals
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Meta(EndPoint endPoint, SolrRequest.METHOD method, CollectionAction action, Meta(EndPoint endPoint, SolrRequest.METHOD method, CollectionAction action,
String commandName, Map paramsToAttrs, Map prefixParamsToAttrs) { String commandName,
@SuppressWarnings({"rawtypes"})Map paramsToAttrs,
@SuppressWarnings({"rawtypes"})Map prefixParamsToAttrs) {
this.action = action; this.action = action;
this.commandName = commandName; this.commandName = commandName;
this.endPoint = endPoint; this.endPoint = endPoint;
@ -431,6 +434,7 @@ public class CollectionApiMapping {
@SuppressWarnings({"unchecked", "rawtypes"})
private static Collection<String> getParamNames_(CommandOperation op, CommandMeta command) { private static Collection<String> getParamNames_(CommandOperation op, CommandMeta command) {
Object o = op.getCommandData(); Object o = op.getCommandData();
if (o instanceof Map) { if (o instanceof Map) {
@ -443,6 +447,7 @@ public class CollectionApiMapping {
} }
} }
@SuppressWarnings({"unchecked"})
public static void collectKeyNames(Map<String, Object> map, List<String> result, String prefix) { public static void collectKeyNames(Map<String, Object> map, List<String> result, String prefix) {
for (Map.Entry<String, Object> e : map.entrySet()) { for (Map.Entry<String, Object> e : map.entrySet()) {
if (e.getValue() instanceof Map) { if (e.getValue() instanceof Map) {

View File

@ -40,6 +40,7 @@ public abstract class ConfigSetAdminRequest
protected ConfigSetAction action = null; protected ConfigSetAction action = null;
@SuppressWarnings({"rawtypes"})
protected ConfigSetAdminRequest setAction(ConfigSetAction action) { protected ConfigSetAdminRequest setAction(ConfigSetAction action) {
this.action = action; this.action = action;
return this; return this;
@ -139,7 +140,7 @@ public abstract class ConfigSetAdminRequest
params.set("baseConfigSet", baseConfigSetName); params.set("baseConfigSet", baseConfigSetName);
} }
if (properties != null) { if (properties != null) {
for (Map.Entry entry : properties.entrySet()) { for (@SuppressWarnings({"rawtypes"})Map.Entry entry : properties.entrySet()) {
params.set(PROPERTY_PREFIX + "." + entry.getKey().toString(), params.set(PROPERTY_PREFIX + "." + entry.getKey().toString(),
entry.getValue().toString()); entry.getValue().toString());
} }

View File

@ -64,8 +64,9 @@ public class CoreApiMapping {
public final CoreAdminAction action; public final CoreAdminAction action;
public final Map<String, String> paramstoAttr; public final Map<String, String> paramstoAttr;
@SuppressWarnings({"unchecked"})
Meta(EndPoint endPoint, SolrRequest.METHOD method, CoreAdminAction action, String commandName, Meta(EndPoint endPoint, SolrRequest.METHOD method, CoreAdminAction action, String commandName,
Map paramstoAttr) { @SuppressWarnings({"rawtypes"})Map paramstoAttr) {
this.commandName = commandName; this.commandName = commandName;
this.endPoint = endPoint; this.endPoint = endPoint;
this.method = method; this.method = method;

View File

@ -71,8 +71,11 @@ public class JavaBinUpdateRequestCodec {
* *
* @throws IOException in case of an exception during marshalling or writing to the stream * @throws IOException in case of an exception during marshalling or writing to the stream
*/ */
@SuppressWarnings({"unchecked"})
public void marshal(UpdateRequest updateRequest, OutputStream os) throws IOException { public void marshal(UpdateRequest updateRequest, OutputStream os) throws IOException {
@SuppressWarnings({"rawtypes"})
NamedList nl = new NamedList(); NamedList nl = new NamedList();
@SuppressWarnings({"rawtypes"})
NamedList params = solrParamsToNamedList(updateRequest.getParams()); NamedList params = solrParamsToNamedList(updateRequest.getParams());
if (updateRequest.getCommitWithin() != -1) { if (updateRequest.getCommitWithin() != -1) {
params.add("commitWithin", updateRequest.getCommitWithin()); params.add("commitWithin", updateRequest.getCommitWithin());
@ -115,6 +118,7 @@ public class JavaBinUpdateRequestCodec {
* *
* @throws IOException in case of an exception while reading from the input stream or unmarshalling * @throws IOException in case of an exception while reading from the input stream or unmarshalling
*/ */
@SuppressWarnings({"unchecked", "rawtypes"})
public UpdateRequest unmarshal(InputStream is, final StreamingUpdateHandler handler) throws IOException { public UpdateRequest unmarshal(InputStream is, final StreamingUpdateHandler handler) throws IOException {
final UpdateRequest updateRequest = new UpdateRequest(); final UpdateRequest updateRequest = new UpdateRequest();
List<List<NamedList>> doclist; List<List<NamedList>> doclist;
@ -181,6 +185,7 @@ public class JavaBinUpdateRequestCodec {
} }
@SuppressWarnings({"rawtypes"})
private NamedList solrParamsToNamedList(SolrParams params) { private NamedList solrParamsToNamedList(SolrParams params) {
if (params == null) return new NamedList(); if (params == null) return new NamedList();
return params.toNamedList(); return params.toNamedList();
@ -204,6 +209,7 @@ public class JavaBinUpdateRequestCodec {
class StreamingCodec extends JavaBinCodec { class StreamingCodec extends JavaBinCodec {
@SuppressWarnings({"rawtypes"})
private final NamedList[] namedList; private final NamedList[] namedList;
private final UpdateRequest updateRequest; private final UpdateRequest updateRequest;
private final StreamingUpdateHandler handler; private final StreamingUpdateHandler handler;
@ -212,7 +218,7 @@ public class JavaBinUpdateRequestCodec {
// is ever refactored, this will not work. // is ever refactored, this will not work.
private boolean seenOuterMostDocIterator; private boolean seenOuterMostDocIterator;
public StreamingCodec(NamedList[] namedList, UpdateRequest updateRequest, StreamingUpdateHandler handler) { public StreamingCodec(@SuppressWarnings({"rawtypes"})NamedList[] namedList, UpdateRequest updateRequest, StreamingUpdateHandler handler) {
this.namedList = namedList; this.namedList = namedList;
this.updateRequest = updateRequest; this.updateRequest = updateRequest;
this.handler = handler; this.handler = handler;
@ -220,11 +226,13 @@ public class JavaBinUpdateRequestCodec {
} }
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected SolrInputDocument createSolrInputDocument(int sz) { protected SolrInputDocument createSolrInputDocument(int sz) {
return new MaskCharSequenceSolrInputDoc(new LinkedHashMap(sz)); return new MaskCharSequenceSolrInputDoc(new LinkedHashMap(sz));
} }
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"})
public NamedList readNamedList(DataInputInputStream dis) throws IOException { public NamedList readNamedList(DataInputInputStream dis) throws IOException {
int sz = readSize(dis); int sz = readSize(dis);
NamedList nl = new NamedList(); NamedList nl = new NamedList();
@ -239,6 +247,7 @@ public class JavaBinUpdateRequestCodec {
return nl; return nl;
} }
@SuppressWarnings({"rawtypes"})
private SolrInputDocument listToSolrInputDocument(List<NamedList> namedList) { private SolrInputDocument listToSolrInputDocument(List<NamedList> namedList) {
SolrInputDocument doc = new SolrInputDocument(); SolrInputDocument doc = new SolrInputDocument();
for (int i = 0; i < namedList.size(); i++) { for (int i = 0; i < namedList.size(); i++) {
@ -271,6 +280,7 @@ public class JavaBinUpdateRequestCodec {
} }
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"})
public List readIterator(DataInputInputStream fis) throws IOException { public List readIterator(DataInputInputStream fis) throws IOException {
// default behavior for reading any regular Iterator in the stream // default behavior for reading any regular Iterator in the stream
if (seenOuterMostDocIterator) return super.readIterator(fis); if (seenOuterMostDocIterator) return super.readIterator(fis);
@ -282,6 +292,7 @@ public class JavaBinUpdateRequestCodec {
} }
@SuppressWarnings({"unchecked", "rawtypes"})
private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException { private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException {
if(namedList[0] == null) namedList[0] = new NamedList(); if(namedList[0] == null) namedList[0] = new NamedList();
NamedList params = (NamedList) namedList[0].get("params"); NamedList params = (NamedList) namedList[0].get("params");
@ -338,11 +349,13 @@ public class JavaBinUpdateRequestCodec {
} }
} }
private SolrInputDocument convertMapToSolrInputDoc(Map m) { @SuppressWarnings({"unchecked"})
private SolrInputDocument convertMapToSolrInputDoc(@SuppressWarnings({"rawtypes"})Map m) {
SolrInputDocument result = createSolrInputDocument(m.size()); SolrInputDocument result = createSolrInputDocument(m.size());
m.forEach((k, v) -> { m.forEach((k, v) -> {
if (CHILDDOC.equals(k.toString())) { if (CHILDDOC.equals(k.toString())) {
if (v instanceof List) { if (v instanceof List) {
@SuppressWarnings({"rawtypes"})
List list = (List) v; List list = (List) v;
for (Object o : list) { for (Object o : list) {
if (o instanceof Map) { if (o instanceof Map) {

View File

@ -38,6 +38,7 @@ import static org.apache.solr.common.params.UpdateParams.ASSUME_CONTENT_TYPE;
public class MultiContentWriterRequest extends AbstractUpdateRequest { public class MultiContentWriterRequest extends AbstractUpdateRequest {
@SuppressWarnings({"rawtypes"})
private final Iterator<Pair<NamedList, Object>> payload; private final Iterator<Pair<NamedList, Object>> payload;
/** /**
@ -47,7 +48,8 @@ public class MultiContentWriterRequest extends AbstractUpdateRequest {
* @param payload add the per doc params, The Object could be a ByteBuffer or byte[] * @param payload add the per doc params, The Object could be a ByteBuffer or byte[]
*/ */
public MultiContentWriterRequest(METHOD m, String path, Iterator<Pair<NamedList, Object>> payload) { public MultiContentWriterRequest(METHOD m, String path,
@SuppressWarnings({"rawtypes"})Iterator<Pair<NamedList, Object>> payload) {
super(m, path); super(m, path);
params = new ModifiableSolrParams(); params = new ModifiableSolrParams();
params.add("multistream", "true"); params.add("multistream", "true");
@ -59,12 +61,15 @@ public class MultiContentWriterRequest extends AbstractUpdateRequest {
public RequestWriter.ContentWriter getContentWriter(String expectedType) { public RequestWriter.ContentWriter getContentWriter(String expectedType) {
return new RequestWriter.ContentWriter() { return new RequestWriter.ContentWriter() {
@Override @Override
@SuppressWarnings({"unchecked"})
public void write(OutputStream os) throws IOException { public void write(OutputStream os) throws IOException {
new JavaBinCodec().marshal((IteratorWriter) iw -> { new JavaBinCodec().marshal((IteratorWriter) iw -> {
while (payload.hasNext()) { while (payload.hasNext()) {
@SuppressWarnings({"rawtypes"})
Pair<NamedList, Object> next = payload.next(); Pair<NamedList, Object> next = payload.next();
if (next.second() instanceof ByteBuffer || next.second() instanceof byte[]) { if (next.second() instanceof ByteBuffer || next.second() instanceof byte[]) {
@SuppressWarnings({"rawtypes"})
NamedList params = next.first(); NamedList params = next.first();
if(params.get(ASSUME_CONTENT_TYPE) == null){ if(params.get(ASSUME_CONTENT_TYPE) == null){
String detectedType = detect(next.second()); String detectedType = detect(next.second());

View File

@ -52,7 +52,7 @@ public class RequestWriter {
* {@link org.apache.solr.client.solrj.request.RequestWriter#getContentStreams(SolrRequest)} is * {@link org.apache.solr.client.solrj.request.RequestWriter#getContentStreams(SolrRequest)} is
* invoked to do a pull write. * invoked to do a pull write.
*/ */
public ContentWriter getContentWriter(SolrRequest req) { public ContentWriter getContentWriter(@SuppressWarnings({"rawtypes"})SolrRequest req) {
if (req instanceof UpdateRequest) { if (req instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) req; UpdateRequest updateRequest = (UpdateRequest) req;
if (isEmpty(updateRequest)) return null; if (isEmpty(updateRequest)) return null;
@ -77,7 +77,8 @@ public class RequestWriter {
* @deprecated Use {@link #getContentWriter(SolrRequest)}. * @deprecated Use {@link #getContentWriter(SolrRequest)}.
*/ */
@Deprecated @Deprecated
public Collection<ContentStream> getContentStreams(SolrRequest req) throws IOException { @SuppressWarnings({"unchecked"})
public Collection<ContentStream> getContentStreams(@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {
if (req instanceof UpdateRequest) { if (req instanceof UpdateRequest) {
return null; return null;
} }
@ -91,11 +92,11 @@ public class RequestWriter {
updateRequest.getDocIterator() == null; updateRequest.getDocIterator() == null;
} }
public String getPath(SolrRequest req) { public String getPath(@SuppressWarnings({"rawtypes"})SolrRequest req) {
return req.getPath(); return req.getPath();
} }
public void write(SolrRequest request, OutputStream os) throws IOException { public void write(@SuppressWarnings({"rawtypes"})SolrRequest request, OutputStream os) throws IOException {
if (request instanceof UpdateRequest) { if (request instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) request; UpdateRequest updateRequest = (UpdateRequest) request;
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8));
@ -129,11 +130,11 @@ public class RequestWriter {
} }
} }
protected boolean isNull(List l) { protected boolean isNull(@SuppressWarnings({"rawtypes"})List l) {
return l == null || l.isEmpty(); return l == null || l.isEmpty();
} }
protected boolean isNull(Map l) { protected boolean isNull(@SuppressWarnings({"rawtypes"})Map l) {
return l == null || l.isEmpty(); return l == null || l.isEmpty();
} }
} }

View File

@ -241,7 +241,7 @@ public class UpdateRequest extends AbstractUpdateRequest {
} }
private interface ReqSupplier<T extends LBSolrClient.Req> { private interface ReqSupplier<T extends LBSolrClient.Req> {
T get(SolrRequest solrRequest, List<String> servers); T get(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, List<String> servers);
} }
private <T extends LBSolrClient.Req> Map<String, T> getRoutes(DocRouter router, private <T extends LBSolrClient.Req> Map<String, T> getRoutes(DocRouter router,

View File

@ -38,6 +38,7 @@ public class DomainMap extends HashMap<String, Object> {
put("filter", new ArrayList<String>()); put("filter", new ArrayList<String>());
} }
@SuppressWarnings({"unchecked"})
final List<String> filterList = (List<String>) get("filter"); final List<String> filterList = (List<String>) get("filter");
filterList.add(filter); filterList.add(filter);
return this; return this;
@ -57,6 +58,7 @@ public class DomainMap extends HashMap<String, Object> {
put("query", new ArrayList<String>()); put("query", new ArrayList<String>());
} }
@SuppressWarnings({"unchecked"})
final List<String> queryList = (List<String>) get("query"); final List<String> queryList = (List<String>) get("query");
queryList.add(query); queryList.add(query);
return this; return this;
@ -79,6 +81,7 @@ public class DomainMap extends HashMap<String, Object> {
put("excludeTags", new ArrayList<String>()); put("excludeTags", new ArrayList<String>());
} }
@SuppressWarnings({"unchecked"})
final List<String> excludeTagsList = (List<String>) get("excludeTags"); final List<String> excludeTagsList = (List<String>) get("excludeTags");
excludeTagsList.add(excludeTagsValue); excludeTagsList.add(excludeTagsValue);
return this; return this;

View File

@ -39,7 +39,8 @@ public class HeatmapFacetMap extends JsonFacetMap<HeatmapFacetMap> {
public HeatmapFacetMap getThis() { return this; } public HeatmapFacetMap getThis() { return this; }
@Override @Override
public HeatmapFacetMap withSubFacet(String facetName, JsonFacetMap map) { public HeatmapFacetMap withSubFacet(String facetName,
@SuppressWarnings({"rawtypes"})JsonFacetMap map) {
throw new UnsupportedOperationException(getClass().getName() + " doesn't currently support subfacets"); throw new UnsupportedOperationException(getClass().getName() + " doesn't currently support subfacets");
} }

View File

@ -40,11 +40,13 @@ public abstract class JsonFacetMap<B extends JsonFacetMap<B>> extends HashMap<St
return getThis(); return getThis();
} }
public B withSubFacet(String facetName, JsonFacetMap map) { public B withSubFacet(String facetName,
@SuppressWarnings({"rawtypes"})JsonFacetMap map) {
if (! containsKey("facet")) { if (! containsKey("facet")) {
put("facet", new HashMap<String, Object>()); put("facet", new HashMap<String, Object>());
} }
@SuppressWarnings({"unchecked"})
final Map<String, Object> subFacetMap = (Map<String, Object>) get("facet"); final Map<String, Object> subFacetMap = (Map<String, Object>) get("facet");
subFacetMap.put(facetName, map); subFacetMap.put(facetName, map);
return getThis(); return getThis();
@ -55,6 +57,7 @@ public abstract class JsonFacetMap<B extends JsonFacetMap<B>> extends HashMap<St
put("facet", new HashMap<String, Object>()); put("facet", new HashMap<String, Object>());
} }
@SuppressWarnings({"unchecked"})
final Map<String, Object> subFacetMap = (Map<String, Object>) get("facet"); final Map<String, Object> subFacetMap = (Map<String, Object>) get("facet");
subFacetMap.put(facetName, statFacet); subFacetMap.put(facetName, statFacet);
return getThis(); return getThis();

View File

@ -165,6 +165,7 @@ public class JsonQueryRequest extends QueryRequest {
jsonRequestMap.put("facet", new HashMap<String, Object>()); jsonRequestMap.put("facet", new HashMap<String, Object>());
} }
@SuppressWarnings({"unchecked"})
final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet"); final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet");
facetMap.put(facetName, facetJson); facetMap.put(facetName, facetJson);
return this; return this;
@ -205,6 +206,7 @@ public class JsonQueryRequest extends QueryRequest {
jsonRequestMap.put("facet", new HashMap<String, Object>()); jsonRequestMap.put("facet", new HashMap<String, Object>());
} }
@SuppressWarnings({"unchecked"})
final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet"); final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet");
facetMap.put(facetName, facetWriter); facetMap.put(facetName, facetWriter);
return this; return this;
@ -239,6 +241,7 @@ public class JsonQueryRequest extends QueryRequest {
jsonRequestMap.put("facet", new HashMap<String, Object>()); jsonRequestMap.put("facet", new HashMap<String, Object>());
} }
@SuppressWarnings({"unchecked"})
final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet"); final Map<String, Object> facetMap = (Map<String, Object>) jsonRequestMap.get("facet");
facetMap.put(facetName, facetValue); facetMap.put(facetName, facetValue);
return this; return this;
@ -299,6 +302,7 @@ public class JsonQueryRequest extends QueryRequest {
* localparams query (e.g. "{!lucene df=text v='solr'}" ) * localparams query (e.g. "{!lucene df=text v='solr'}" )
* @throws IllegalArgumentException if {@code filterQuery} is null * @throws IllegalArgumentException if {@code filterQuery} is null
*/ */
@SuppressWarnings({"unchecked"})
public JsonQueryRequest withFilter(String filterQuery) { public JsonQueryRequest withFilter(String filterQuery) {
if (filterQuery == null) { if (filterQuery == null) {
throw new IllegalArgumentException("'filterQuery' must be non-null"); throw new IllegalArgumentException("'filterQuery' must be non-null");
@ -326,6 +330,7 @@ public class JsonQueryRequest extends QueryRequest {
* @param filterQuery a Map of values representing the filter request you wish to send. * @param filterQuery a Map of values representing the filter request you wish to send.
* @throws IllegalArgumentException if {@code filterQuery} is null * @throws IllegalArgumentException if {@code filterQuery} is null
*/ */
@SuppressWarnings({"unchecked"})
public JsonQueryRequest withFilter(Map<String, Object> filterQuery) { public JsonQueryRequest withFilter(Map<String, Object> filterQuery) {
if (filterQuery == null) { if (filterQuery == null) {
throw new IllegalArgumentException("'filterQuery' parameter must be non-null"); throw new IllegalArgumentException("'filterQuery' parameter must be non-null");
@ -343,6 +348,7 @@ public class JsonQueryRequest extends QueryRequest {
*/ */
public JsonQueryRequest returnFields(String... fieldNames) { public JsonQueryRequest returnFields(String... fieldNames) {
jsonRequestMap.putIfAbsent("fields", new ArrayList<String>()); jsonRequestMap.putIfAbsent("fields", new ArrayList<String>());
@SuppressWarnings({"unchecked"})
final List<String> fields = (List<String>) jsonRequestMap.get("fields"); final List<String> fields = (List<String>) jsonRequestMap.get("fields");
for (String fieldName : fieldNames) { for (String fieldName : fieldNames) {
fields.add(fieldName); fields.add(fieldName);
@ -364,6 +370,7 @@ public class JsonQueryRequest extends QueryRequest {
} }
jsonRequestMap.putIfAbsent("fields", new ArrayList<String>()); jsonRequestMap.putIfAbsent("fields", new ArrayList<String>());
@SuppressWarnings({"unchecked"})
final List<String> fields = (List<String>) jsonRequestMap.get("fields"); final List<String> fields = (List<String>) jsonRequestMap.get("fields");
for (String fieldName : fieldNames) { for (String fieldName : fieldNames) {
fields.add(fieldName); fields.add(fieldName);
@ -387,6 +394,7 @@ public class JsonQueryRequest extends QueryRequest {
* *
* @throws IllegalArgumentException if either {@code name} or {@code value} are null * @throws IllegalArgumentException if either {@code name} or {@code value} are null
*/ */
@SuppressWarnings({"unchecked"})
public JsonQueryRequest withParam(String name, Object value) { public JsonQueryRequest withParam(String name, Object value) {
if (name == null) { if (name == null) {
throw new IllegalArgumentException("'name' parameter must be non-null"); throw new IllegalArgumentException("'name' parameter must be non-null");

View File

@ -74,6 +74,7 @@ public class AnalysisResponseBase extends SolrResponseBase {
TokenInfo tokenInfo = buildTokenInfoFromString((String) phaseValue); TokenInfo tokenInfo = buildTokenInfoFromString((String) phaseValue);
phase.addTokenInfo(tokenInfo); phase.addTokenInfo(tokenInfo);
} else { } else {
@SuppressWarnings({"unchecked"})
List<NamedList<Object>> tokens = (List<NamedList<Object>>) phaseEntry.getValue(); List<NamedList<Object>> tokens = (List<NamedList<Object>>) phaseEntry.getValue();
for (NamedList<Object> token : tokens) { for (NamedList<Object> token : tokens) {
TokenInfo tokenInfo = buildTokenInfo(token); TokenInfo tokenInfo = buildTokenInfo(token);

View File

@ -83,6 +83,7 @@ public class CollectionAdminResponse extends SolrResponseBase
return Aliases.convertMapOfCommaDelimitedToMapOfList(getAliases()); return Aliases.convertMapOfCommaDelimitedToMapOfList(getAliases());
} }
@SuppressWarnings({"unchecked"})
public Map<String, Map<String, String>> getAliasProperties() { public Map<String, Map<String, String>> getAliasProperties() {
NamedList<Object> response = getResponse(); NamedList<Object> response = getResponse();
if (response.get("properties") != null) { if (response.get("properties") != null) {

View File

@ -23,12 +23,13 @@ import org.apache.solr.common.util.NamedList;
*/ */
public class ConfigSetAdminResponse extends SolrResponseBase public class ConfigSetAdminResponse extends SolrResponseBase
{ {
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked"})
public NamedList<String> getErrorMessages() public NamedList<String> getErrorMessages()
{ {
return (NamedList<String>) getResponse().get( "exceptions" ); return (NamedList<String>) getResponse().get( "exceptions" );
} }
@SuppressWarnings({"unchecked"})
public static class List extends ConfigSetAdminResponse { public static class List extends ConfigSetAdminResponse {
public java.util.List<String> getConfigSets() { public java.util.List<String> getConfigSets() {
return (java.util.List<String>) getResponse().get("configSets"); return (java.util.List<String>) getResponse().get("configSets");

View File

@ -40,6 +40,7 @@ public abstract class DelegationTokenResponse extends SolrResponseBase {
*/ */
public String getDelegationToken() { public String getDelegationToken() {
try { try {
@SuppressWarnings({"rawtypes"})
Map map = (Map)getResponse().get("Token"); Map map = (Map)getResponse().get("Token");
if (map != null) { if (map != null) {
return (String)map.get("urlString"); return (String)map.get("urlString");
@ -76,7 +77,9 @@ public abstract class DelegationTokenResponse extends SolrResponseBase {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public NamedList<Object> processResponse(InputStream body, String encoding) { public NamedList<Object> processResponse(InputStream body, String encoding) {
@SuppressWarnings({"rawtypes"})
Map map = null; Map map = null;
try { try {
ObjectBuilder builder = new ObjectBuilder( ObjectBuilder builder = new ObjectBuilder(

View File

@ -51,6 +51,7 @@ public class FieldStatsInfo implements Serializable {
Map<Double, Double> percentiles; Map<Double, Double> percentiles;
@SuppressWarnings({"unchecked"})
public FieldStatsInfo( NamedList<Object> nl, String fname ) public FieldStatsInfo( NamedList<Object> nl, String fname )
{ {
name = fname; name = fname;

View File

@ -29,9 +29,11 @@ public class PivotField implements Serializable
final List<PivotField> _pivot; final List<PivotField> _pivot;
final Map<String,FieldStatsInfo> _statsInfo; final Map<String,FieldStatsInfo> _statsInfo;
final Map<String,Integer> _querycounts; final Map<String,Integer> _querycounts;
@SuppressWarnings({"rawtypes"})
final List<RangeFacet> _ranges; final List<RangeFacet> _ranges;
public PivotField( String f, Object v, int count, List<PivotField> pivot, Map<String,FieldStatsInfo> statsInfo, Map<String,Integer> queryCounts, List<RangeFacet> ranges) public PivotField( String f, Object v, int count, List<PivotField> pivot, Map<String,FieldStatsInfo> statsInfo, Map<String,Integer> queryCounts,
@SuppressWarnings({"rawtypes"})List<RangeFacet> ranges)
{ {
_field = f; _field = f;
_value = v; _value = v;
@ -66,6 +68,7 @@ public class PivotField implements Serializable
return _querycounts; return _querycounts;
} }
@SuppressWarnings({"rawtypes"})
public List<RangeFacet> getFacetRanges() { public List<RangeFacet> getFacetRanges() {
return _ranges; return _ranges;
} }

View File

@ -43,6 +43,7 @@ public class QueryResponse extends SolrResponseBase
// Direct pointers to known types // Direct pointers to known types
private NamedList<Object> _header = null; private NamedList<Object> _header = null;
private SolrDocumentList _results = null; private SolrDocumentList _results = null;
@SuppressWarnings({"rawtypes"})
private NamedList<ArrayList> _sortvalues = null; private NamedList<ArrayList> _sortvalues = null;
private NamedList<Object> _facetInfo = null; private NamedList<Object> _facetInfo = null;
private NamedList<Object> _debugInfo = null; private NamedList<Object> _debugInfo = null;
@ -68,6 +69,7 @@ public class QueryResponse extends SolrResponseBase
private List<FacetField> _facetFields = null; private List<FacetField> _facetFields = null;
private List<FacetField> _limitingFacets = null; private List<FacetField> _limitingFacets = null;
private List<FacetField> _facetDates = null; private List<FacetField> _facetDates = null;
@SuppressWarnings({"rawtypes"})
private List<RangeFacet> _facetRanges = null; private List<RangeFacet> _facetRanges = null;
private NamedList<List<PivotField>> _facetPivot = null; private NamedList<List<PivotField>> _facetPivot = null;
private List<IntervalFacet> _intervalFacets = null; private List<IntervalFacet> _intervalFacets = null;
@ -117,6 +119,7 @@ public class QueryResponse extends SolrResponseBase
} }
@Override @Override
@SuppressWarnings({"rawtypes"})
public void setResponse( NamedList<Object> res ) public void setResponse( NamedList<Object> res )
{ {
super.setResponse( res ); super.setResponse( res );
@ -277,6 +280,7 @@ public class QueryResponse extends SolrResponseBase
} }
for (Object oGrp : groupsArr) { for (Object oGrp : groupsArr) {
@SuppressWarnings({"rawtypes"})
SimpleOrderedMap grpMap = (SimpleOrderedMap) oGrp; SimpleOrderedMap grpMap = (SimpleOrderedMap) oGrp;
Object sGroupValue = grpMap.get( "groupValue"); Object sGroupValue = grpMap.get( "groupValue");
SolrDocumentList doclist = (SolrDocumentList) grpMap.get( "doclist"); SolrDocumentList doclist = (SolrDocumentList) grpMap.get( "doclist");
@ -316,6 +320,7 @@ public class QueryResponse extends SolrResponseBase
} }
} }
@SuppressWarnings({"rawtypes"})
private void extractFacetInfo( NamedList<Object> info ) private void extractFacetInfo( NamedList<Object> info )
{ {
// Parse the queries // Parse the queries
@ -379,6 +384,7 @@ public class QueryResponse extends SolrResponseBase
} }
} }
@SuppressWarnings({"rawtypes"})
private List<RangeFacet> extractRangeFacets(NamedList<NamedList<Object>> rf) { private List<RangeFacet> extractRangeFacets(NamedList<NamedList<Object>> rf) {
List<RangeFacet> facetRanges = new ArrayList<>( rf.size() ); List<RangeFacet> facetRanges = new ArrayList<>( rf.size() );
@ -429,6 +435,7 @@ public class QueryResponse extends SolrResponseBase
return facetRanges; return facetRanges;
} }
@SuppressWarnings({"rawtypes"})
protected List<PivotField> readPivots( List<NamedList> list ) protected List<PivotField> readPivots( List<NamedList> list )
{ {
ArrayList<PivotField> values = new ArrayList<>( list.size() ); ArrayList<PivotField> values = new ArrayList<>( list.size() );
@ -514,6 +521,7 @@ public class QueryResponse extends SolrResponseBase
return _results; return _results;
} }
@SuppressWarnings({"rawtypes"})
public NamedList<ArrayList> getSortValues(){ public NamedList<ArrayList> getSortValues(){
return _sortvalues; return _sortvalues;
} }
@ -595,6 +603,7 @@ public class QueryResponse extends SolrResponseBase
return _facetDates; return _facetDates;
} }
@SuppressWarnings({"rawtypes"})
public List<RangeFacet> getFacetRanges() { public List<RangeFacet> getFacetRanges() {
return _facetRanges; return _facetRanges;
} }

View File

@ -107,9 +107,11 @@ public abstract class RangeFacet<B, G> {
private final String value; private final String value;
private final int count; private final int count;
@SuppressWarnings({"rawtypes"})
private final RangeFacet rangeFacet; private final RangeFacet rangeFacet;
public Count(String value, int count, RangeFacet rangeFacet) { public Count(String value, int count,
@SuppressWarnings({"rawtypes"})RangeFacet rangeFacet) {
this.value = value; this.value = value;
this.count = count; this.count = count;
this.rangeFacet = rangeFacet; this.rangeFacet = rangeFacet;
@ -123,6 +125,7 @@ public abstract class RangeFacet<B, G> {
return count; return count;
} }
@SuppressWarnings({"rawtypes"})
public RangeFacet getRangeFacet() { public RangeFacet getRangeFacet() {
return rangeFacet; return rangeFacet;
} }

View File

@ -62,12 +62,14 @@ public class SolrResponseBase extends SolrResponse implements MapWriter
return response.toString(); return response.toString();
} }
@SuppressWarnings({"rawtypes"})
public NamedList getResponseHeader() { public NamedList getResponseHeader() {
return (NamedList) response.get("responseHeader"); return (NamedList) response.get("responseHeader");
} }
// these two methods are based on the logic in SolrCore.setResponseHeaderValues(...) // these two methods are based on the logic in SolrCore.setResponseHeaderValues(...)
public int getStatus() { public int getStatus() {
@SuppressWarnings({"rawtypes"})
NamedList header = getResponseHeader(); NamedList header = getResponseHeader();
if (header != null) { if (header != null) {
return (Integer) header.get("status"); return (Integer) header.get("status");
@ -78,6 +80,7 @@ public class SolrResponseBase extends SolrResponse implements MapWriter
} }
public int getQTime() { public int getQTime() {
@SuppressWarnings({"rawtypes"})
NamedList header = getResponseHeader(); NamedList header = getResponseHeader();
if (header != null) { if (header != null) {
return (Integer) header.get("QTime"); return (Integer) header.get("QTime");

View File

@ -145,6 +145,7 @@ public class SpellCheckResponse {
private List<String> alternatives = new ArrayList<>(); private List<String> alternatives = new ArrayList<>();
private List<Integer> alternativeFrequencies; private List<Integer> alternativeFrequencies;
@SuppressWarnings({"rawtypes"})
public Suggestion(String token, NamedList<Object> suggestion) { public Suggestion(String token, NamedList<Object> suggestion) {
this.token = token; this.token = token;
for (int i = 0; i < suggestion.size(); i++) { for (int i = 0; i < suggestion.size(); i++) {

View File

@ -35,6 +35,7 @@ public class SuggesterResponse {
private final Map<String, List<Suggestion>> suggestionsPerDictionary = new LinkedHashMap<>(); private final Map<String, List<Suggestion>> suggestionsPerDictionary = new LinkedHashMap<>();
@SuppressWarnings({"unchecked", "rawtypes"})
public SuggesterResponse(Map<String, NamedList<Object>> suggestInfo) { public SuggesterResponse(Map<String, NamedList<Object>> suggestInfo) {
for (Map.Entry<String, NamedList<Object>> entry : suggestInfo.entrySet()) { for (Map.Entry<String, NamedList<Object>> entry : suggestInfo.entrySet()) {
SimpleOrderedMap suggestionsNode = (SimpleOrderedMap) entry.getValue().getVal(0); SimpleOrderedMap suggestionsNode = (SimpleOrderedMap) entry.getValue().getVal(0);

View File

@ -49,6 +49,7 @@ public class BucketBasedJsonFacet {
private long afterLastBucketCount = UNSET_FLAG; private long afterLastBucketCount = UNSET_FLAG;
private long betweenAllBucketsCount = UNSET_FLAG; private long betweenAllBucketsCount = UNSET_FLAG;
@SuppressWarnings({"unchecked", "rawtypes"})
public BucketBasedJsonFacet(NamedList<Object> bucketBasedFacet) { public BucketBasedJsonFacet(NamedList<Object> bucketBasedFacet) {
for (Map.Entry<String, Object> entry : bucketBasedFacet) { for (Map.Entry<String, Object> entry : bucketBasedFacet) {
final String key = entry.getKey(); final String key = entry.getKey();

View File

@ -44,6 +44,7 @@ public class HeatmapJsonFacet {
private List<List<Integer>> countGrid; private List<List<Integer>> countGrid;
private String countEncodedAsBase64PNG; private String countEncodedAsBase64PNG;
@SuppressWarnings({"unchecked"})
public HeatmapJsonFacet(NamedList<Object> heatmapNL) { public HeatmapJsonFacet(NamedList<Object> heatmapNL) {
gridLevel = (int) heatmapNL.get("gridLevel"); gridLevel = (int) heatmapNL.get("gridLevel");
columns = (int) heatmapNL.get("columns"); columns = (int) heatmapNL.get("columns");

View File

@ -56,6 +56,7 @@ public class NestableJsonFacet {
// Stat/agg facet value // Stat/agg facet value
statsByName.put(key, entry.getValue()); statsByName.put(key, entry.getValue());
} else if(entry.getValue() instanceof NamedList) { // Either heatmap/query/range/terms facet } else if(entry.getValue() instanceof NamedList) { // Either heatmap/query/range/terms facet
@SuppressWarnings({"unchecked"})
final NamedList<Object> facet = (NamedList<Object>) entry.getValue(); final NamedList<Object> facet = (NamedList<Object>) entry.getValue();
final boolean isBucketBased = facet.get("buckets") != null; final boolean isBucketBased = facet.get("buckets") != null;
final boolean isHeatmap = HeatmapJsonFacet.isHeatmapFacet(facet); final boolean isHeatmap = HeatmapJsonFacet.isHeatmapFacet(facet);

View File

@ -132,7 +132,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
} }
private static SchemaRepresentation createSchemaConfiguration(Map schemaObj) { private static SchemaRepresentation createSchemaConfiguration(
@SuppressWarnings({"rawtypes"})Map schemaObj) {
SchemaRepresentation schemaRepresentation = new SchemaRepresentation(); SchemaRepresentation schemaRepresentation = new SchemaRepresentation();
schemaRepresentation.setName(getSchemaName(schemaObj)); schemaRepresentation.setName(getSchemaName(schemaObj));
schemaRepresentation.setVersion(getSchemaVersion(schemaObj)); schemaRepresentation.setVersion(getSchemaVersion(schemaObj));
@ -145,19 +146,24 @@ public class SchemaResponse extends SolrResponseBase {
return schemaRepresentation; return schemaRepresentation;
} }
private static String getSchemaName(Map schemaNamedList) { private static String getSchemaName(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
return (String) schemaNamedList.get("name"); return (String) schemaNamedList.get("name");
} }
private static Float getSchemaVersion(Map schemaNamedList) { private static Float getSchemaVersion(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
return (Float) schemaNamedList.get("version"); return (Float) schemaNamedList.get("version");
} }
private static String getSchemaUniqueKey(Map schemaNamedList) { private static String getSchemaUniqueKey(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
return (String) schemaNamedList.get("uniqueKey"); return (String) schemaNamedList.get("uniqueKey");
} }
private static Map<String, Object> getSimilarity(Map schemaNamedList) { private static Map<String, Object> getSimilarity(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
@SuppressWarnings({"unchecked"})
NamedList<Object> similarityNamedList = (NamedList<Object>) schemaNamedList.get("similarity"); NamedList<Object> similarityNamedList = (NamedList<Object>) schemaNamedList.get("similarity");
Map<String, Object> similarity = null; Map<String, Object> similarity = null;
if (similarityNamedList != null) similarity = extractAttributeMap(similarityNamedList); if (similarityNamedList != null) similarity = extractAttributeMap(similarityNamedList);
@ -165,7 +171,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<Map<String, Object>> getFields(Map schemaNamedList) { private static List<Map<String, Object>> getFields(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
List<Map<String, Object>> fieldsAttributes = new LinkedList<>(); List<Map<String, Object>> fieldsAttributes = new LinkedList<>();
List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fields"); List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fields");
for (NamedList<Object> fieldNamedList : fieldsResponse) { for (NamedList<Object> fieldNamedList : fieldsResponse) {
@ -177,7 +184,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<Map<String, Object>> getDynamicFields(Map schemaNamedList) { private static List<Map<String, Object>> getDynamicFields(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
List<Map<String, Object>> dynamicFieldsAttributes = new LinkedList<>(); List<Map<String, Object>> dynamicFieldsAttributes = new LinkedList<>();
List<NamedList<Object>> dynamicFieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("dynamicFields"); List<NamedList<Object>> dynamicFieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("dynamicFields");
for (NamedList<Object> fieldNamedList : dynamicFieldsResponse) { for (NamedList<Object> fieldNamedList : dynamicFieldsResponse) {
@ -189,7 +197,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<Map<String, Object>> getCopyFields(Map schemaNamedList) { private static List<Map<String, Object>> getCopyFields(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
List<Map<String, Object>> copyFieldsAttributes = new LinkedList<>(); List<Map<String, Object>> copyFieldsAttributes = new LinkedList<>();
List<NamedList<Object>> copyFieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("copyFields"); List<NamedList<Object>> copyFieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("copyFields");
for (NamedList<Object> copyFieldNamedList : copyFieldsResponse) { for (NamedList<Object> copyFieldNamedList : copyFieldsResponse) {
@ -201,7 +210,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<FieldTypeDefinition> getFieldTypeDefinitions(Map schemaNamedList) { private static List<FieldTypeDefinition> getFieldTypeDefinitions(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
List<FieldTypeDefinition> fieldTypeDefinitions = new LinkedList<>(); List<FieldTypeDefinition> fieldTypeDefinitions = new LinkedList<>();
List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fieldTypes"); List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fieldTypes");
for (NamedList<Object> fieldNamedList : fieldsResponse) { for (NamedList<Object> fieldNamedList : fieldsResponse) {
@ -213,7 +223,8 @@ public class SchemaResponse extends SolrResponseBase {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<FieldTypeRepresentation> getFieldTypeRepresentations(Map schemaNamedList) { private static List<FieldTypeRepresentation> getFieldTypeRepresentations(
@SuppressWarnings({"rawtypes"})Map schemaNamedList) {
List<FieldTypeRepresentation> fieldTypeRepresentations = new LinkedList<>(); List<FieldTypeRepresentation> fieldTypeRepresentations = new LinkedList<>();
List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fieldTypes"); List<NamedList<Object>> fieldsResponse = (List<NamedList<Object>>) schemaNamedList.get("fieldTypes");
for (NamedList<Object> fieldNamedList : fieldsResponse) { for (NamedList<Object> fieldNamedList : fieldsResponse) {
@ -229,6 +240,7 @@ public class SchemaResponse extends SolrResponseBase {
public void setResponse(NamedList<Object> response) { public void setResponse(NamedList<Object> response) {
super.setResponse(response); super.setResponse(response);
@SuppressWarnings({"rawtypes"})
Map schemaObj = (Map) response.get("schema"); Map schemaObj = (Map) response.get("schema");
schemaRepresentation = createSchemaConfiguration(schemaObj); schemaRepresentation = createSchemaConfiguration(schemaObj);
} }

View File

@ -63,6 +63,7 @@ public class ClientUtils
//------------------------------------------------------------------------ //------------------------------------------------------------------------
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@SuppressWarnings({"unchecked"})
public static void writeXML( SolrInputDocument doc, Writer writer ) throws IOException public static void writeXML( SolrInputDocument doc, Writer writer ) throws IOException
{ {
writer.write("<doc>"); writer.write("<doc>");
@ -81,6 +82,7 @@ public class ClientUtils
update = entry.getKey().toString(); update = entry.getKey().toString();
v = entry.getValue(); v = entry.getValue();
if (v instanceof Collection) { if (v instanceof Collection) {
@SuppressWarnings({"rawtypes"})
Collection values = (Collection) v; Collection values = (Collection) v;
for (Object value : values) { for (Object value : values) {
writeVal(writer, name, value, update); writeVal(writer, name, value, update);

View File

@ -42,12 +42,14 @@ public class LinkedHashMapWriter<V> extends LinkedHashMap<String, V> implements
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public Object _get(String path, Object def) { public Object _get(String path, Object def) {
if (path.indexOf('/') == -1) return getOrDefault(path, (V) def); if (path.indexOf('/') == -1) return getOrDefault(path, (V) def);
return MapWriter.super._get(path, def); return MapWriter.super._get(path, def);
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public Object _get(List<String> path, Object def) { public Object _get(List<String> path, Object def) {
if (path.size() == 1) return getOrDefault(path.get(0), (V) def); if (path.size() == 1) return getOrDefault(path.get(0), (V) def);
return MapWriter.super._get(path, def); return MapWriter.super._get(path, def);

View File

@ -99,7 +99,7 @@ public class SolrDocument extends SolrDocumentBase<Object, SolrDocument> impleme
* set multiple fields with the included contents. This will replace any existing * set multiple fields with the included contents. This will replace any existing
* field with the given name * field with the given name
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
public void setField(String name, Object value) public void setField(String name, Object value)
{ {
if( value instanceof Object[] ) { if( value instanceof Object[] ) {
@ -186,6 +186,7 @@ public class SolrDocument extends SolrDocumentBase<Object, SolrDocument> impleme
public Object getFirstValue(String name) { public Object getFirstValue(String name) {
Object v = _fields.get( name ); Object v = _fields.get( name );
if (v == null || !(v instanceof Collection)) return v; if (v == null || !(v instanceof Collection)) return v;
@SuppressWarnings({"rawtypes"})
Collection c = (Collection)v; Collection c = (Collection)v;
if (c.size() > 0 ) { if (c.size() > 0 ) {
return c.iterator().next(); return c.iterator().next();

View File

@ -108,7 +108,8 @@ public class SolrInputField implements Iterable<Object>, Serializable
public Object getFirstValue() { public Object getFirstValue() {
if (value instanceof Collection) { if (value instanceof Collection) {
Collection c = (Collection<Object>) value; @SuppressWarnings({"unchecked"})
Collection<Object> c = (Collection<Object>) value;
if (c.size() > 0) { if (c.size() > 0) {
return c.iterator().next(); return c.iterator().next();
} }
@ -200,6 +201,7 @@ public class SolrInputField implements Iterable<Object>, Serializable
SolrInputField clone = new SolrInputField(name); SolrInputField clone = new SolrInputField(name);
// We can't clone here, so we rely on simple primitives // We can't clone here, so we rely on simple primitives
if (value instanceof Collection) { if (value instanceof Collection) {
@SuppressWarnings({"unchecked"})
Collection<Object> values = (Collection<Object>) value; Collection<Object> values = (Collection<Object>) value;
Collection<Object> cloneValues = new ArrayList<>(values.size()); Collection<Object> cloneValues = new ArrayList<>(values.size());
cloneValues.addAll(values); cloneValues.addAll(values);

View File

@ -80,7 +80,7 @@ public class Aliases {
* @param zNodeVersion the version of the data in zookeeper that this instance corresponds to * @param zNodeVersion the version of the data in zookeeper that this instance corresponds to
* @return A new immutable Aliases object * @return A new immutable Aliases object
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
public static Aliases fromJSON(byte[] bytes, int zNodeVersion) { public static Aliases fromJSON(byte[] bytes, int zNodeVersion) {
Map<String, Map> aliasMap; Map<String, Map> aliasMap;
if (bytes == null || bytes.length == 0) { if (bytes == null || bytes.length == 0) {
@ -89,6 +89,7 @@ public class Aliases {
aliasMap = (Map<String, Map>) Utils.fromJSON(bytes); aliasMap = (Map<String, Map>) Utils.fromJSON(bytes);
} }
@SuppressWarnings({"rawtypes"})
Map colAliases = aliasMap.getOrDefault(COLLECTION, Collections.emptyMap()); Map colAliases = aliasMap.getOrDefault(COLLECTION, Collections.emptyMap());
colAliases = convertMapOfCommaDelimitedToMapOfList(colAliases); // also unmodifiable colAliases = convertMapOfCommaDelimitedToMapOfList(colAliases); // also unmodifiable
@ -106,6 +107,7 @@ public class Aliases {
assert collectionAliasProperties.isEmpty(); assert collectionAliasProperties.isEmpty();
return null; return null;
} else { } else {
@SuppressWarnings({"rawtypes"})
Map<String,Map> tmp = new LinkedHashMap<>(); Map<String,Map> tmp = new LinkedHashMap<>();
tmp.put(COLLECTION, convertMapOfListToMapOfCommaDelimited(collectionAliases)); tmp.put(COLLECTION, convertMapOfListToMapOfCommaDelimited(collectionAliases));
if (!collectionAliasProperties.isEmpty()) { if (!collectionAliasProperties.isEmpty()) {

View File

@ -219,6 +219,7 @@ public class ClusterState implements JSONWriter.Writable {
if (bytes == null || bytes.length == 0) { if (bytes == null || bytes.length == 0) {
return new ClusterState(liveNodes, Collections.<String, DocCollection>emptyMap()); return new ClusterState(liveNodes, Collections.<String, DocCollection>emptyMap());
} }
@SuppressWarnings({"unchecked"})
Map<String, Object> stateMap = (Map<String, Object>) Utils.fromJSON(bytes); Map<String, Object> stateMap = (Map<String, Object>) Utils.fromJSON(bytes);
return createFromCollectionMap(version, stateMap, liveNodes); return createFromCollectionMap(version, stateMap, liveNodes);
} }
@ -227,6 +228,7 @@ public class ClusterState implements JSONWriter.Writable {
Map<String,CollectionRef> collections = new LinkedHashMap<>(stateMap.size()); Map<String,CollectionRef> collections = new LinkedHashMap<>(stateMap.size());
for (Entry<String, Object> entry : stateMap.entrySet()) { for (Entry<String, Object> entry : stateMap.entrySet()) {
String collectionName = entry.getKey(); String collectionName = entry.getKey();
@SuppressWarnings({"unchecked"})
DocCollection coll = collectionFromObjects(collectionName, (Map<String,Object>)entry.getValue(), version); DocCollection coll = collectionFromObjects(collectionName, (Map<String,Object>)entry.getValue(), version);
collections.put(collectionName, new CollectionRef(coll)); collections.put(collectionName, new CollectionRef(coll));
} }
@ -239,6 +241,7 @@ public class ClusterState implements JSONWriter.Writable {
Map<String,Object> props; Map<String,Object> props;
Map<String,Slice> slices; Map<String,Slice> slices;
@SuppressWarnings({"unchecked"})
Map<String, Object> sliceObjs = (Map<String, Object>) objs.get(DocCollection.SHARDS); Map<String, Object> sliceObjs = (Map<String, Object>) objs.get(DocCollection.SHARDS);
if (sliceObjs == null) { if (sliceObjs == null) {
// legacy format from 4.0... there was no separate "shards" level to contain the collection shards. // legacy format from 4.0... there was no separate "shards" level to contain the collection shards.
@ -258,6 +261,7 @@ public class ClusterState implements JSONWriter.Writable {
// back compat with Solr4.4 // back compat with Solr4.4
router = DocRouter.getDocRouter((String)routerObj); router = DocRouter.getDocRouter((String)routerObj);
} else { } else {
@SuppressWarnings({"rawtypes"})
Map routerProps = (Map)routerObj; Map routerProps = (Map)routerObj;
router = DocRouter.getDocRouter((String) routerProps.get("name")); router = DocRouter.getDocRouter((String) routerProps.get("name"));
} }

View File

@ -188,6 +188,7 @@ public class CompositeIdRouter extends HashBasedRouter {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public List<Range> partitionRange(int partitions, Range range) { public List<Range> partitionRange(int partitions, Range range) {
int min = range.min; int min = range.min;
int max = range.max; int max = range.max;

View File

@ -46,6 +46,7 @@ import static org.apache.solr.common.util.Utils.toJSONString;
/** /**
* Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection") * Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")
*/ */
@SuppressWarnings({"overrides"})
public class DocCollection extends ZkNodeProps implements Iterable<Slice> { public class DocCollection extends ZkNodeProps implements Iterable<Slice> {
public static final String DOC_ROUTER = "router"; public static final String DOC_ROUTER = "router";
@ -382,6 +383,11 @@ public class DocCollection extends ZkNodeProps implements Iterable<Slice> {
return super.equals(that) && Objects.equals(this.name, other.name) && this.znodeVersion == other.znodeVersion; return super.equals(that) && Objects.equals(this.name, other.name) && this.znodeVersion == other.znodeVersion;
} }
// @Override
// public int hashCode() {
// throw new UnsupportedOperationException("TODO unimplemented DocCollection.hashCode");
// }
/** /**
* @return the number of replicas of type {@link org.apache.solr.common.cloud.Replica.Type#NRT} this collection was created with * @return the number of replicas of type {@link org.apache.solr.common.cloud.Replica.Type#NRT} this collection was created with
*/ */

View File

@ -50,6 +50,7 @@ public abstract class DocRouter {
public String getRouteField(DocCollection coll) { public String getRouteField(DocCollection coll) {
if (coll == null) return null; if (coll == null) return null;
@SuppressWarnings({"rawtypes"})
Map m = (Map) coll.get(DOC_ROUTER); Map m = (Map) coll.get(DOC_ROUTER);
if (m == null) return null; if (m == null) return null;
return (String) m.get("field"); return (String) m.get("field");
@ -169,6 +170,7 @@ public abstract class DocRouter {
* of variation in resulting ranges - odd ranges will be larger and even ranges will be smaller * of variation in resulting ranges - odd ranges will be larger and even ranges will be smaller
* by up to that percentage. * by up to that percentage.
*/ */
@SuppressWarnings({"unchecked"})
public List<Range> partitionRange(int partitions, Range range, float fuzz) { public List<Range> partitionRange(int partitions, Range range, float fuzz) {
int min = range.min; int min = range.min;
int max = range.max; int max = range.max;

View File

@ -22,7 +22,7 @@ import java.util.Objects;
import java.util.Set; import java.util.Set;
import org.apache.solr.common.util.Utils; import org.apache.solr.common.util.Utils;
@SuppressWarnings({"overrides"})
public class Replica extends ZkNodeProps { public class Replica extends ZkNodeProps {
/** /**
@ -153,7 +153,10 @@ public class Replica extends ZkNodeProps {
return name.equals(replica.name); return name.equals(replica.name);
} }
// @Override
// public int hashCode() {
// throw new UnsupportedOperationException("TODO unimplemented Replica.hashCode()");
// }
/** Also known as coreNodeName. */ /** Also known as coreNodeName. */
public String getName() { public String getName() {
return name; return name;

View File

@ -40,6 +40,7 @@ public class Slice extends ZkNodeProps implements Iterable<Replica> {
public final String collection; public final String collection;
/** Loads multiple slices into a Map from a generic Map that probably came from deserialized JSON. */ /** Loads multiple slices into a Map from a generic Map that probably came from deserialized JSON. */
@SuppressWarnings({"unchecked"})
public static Map<String,Slice> loadAllFromMap(String collection, Map<String, Object> genericSlices) { public static Map<String,Slice> loadAllFromMap(String collection, Map<String, Object> genericSlices) {
if (genericSlices == null) return Collections.emptyMap(); if (genericSlices == null) return Collections.emptyMap();
Map<String, Slice> result = new LinkedHashMap<>(genericSlices.size()); Map<String, Slice> result = new LinkedHashMap<>(genericSlices.size());
@ -129,6 +130,7 @@ public class Slice extends ZkNodeProps implements Iterable<Replica> {
* @param replicas The replicas of the slice. This is used directly and a copy is not made. If null, replicas will be constructed from props. * @param replicas The replicas of the slice. This is used directly and a copy is not made. If null, replicas will be constructed from props.
* @param props The properties of the slice - a shallow copy will always be made. * @param props The properties of the slice - a shallow copy will always be made.
*/ */
@SuppressWarnings({"unchecked", "rawtypes"})
public Slice(String name, Map<String,Replica> replicas, Map<String,Object> props, String collection) { public Slice(String name, Map<String,Replica> replicas, Map<String,Object> props, String collection) {
super( props==null ? new LinkedHashMap<String,Object>(2) : new LinkedHashMap<>(props)); super( props==null ? new LinkedHashMap<String,Object>(2) : new LinkedHashMap<>(props));
this.name = name; this.name = name;
@ -188,6 +190,7 @@ public class Slice extends ZkNodeProps implements Iterable<Replica> {
} }
@SuppressWarnings({"unchecked"})
private Map<String,Replica> makeReplicas(String collection, String slice,Map<String,Object> genericReplicas) { private Map<String,Replica> makeReplicas(String collection, String slice,Map<String,Object> genericReplicas) {
if (genericReplicas == null) return new HashMap<>(1); if (genericReplicas == null) return new HashMap<>(1);
Map<String,Replica> result = new LinkedHashMap<>(genericReplicas.size()); Map<String,Replica> result = new LinkedHashMap<>(genericReplicas.size());

View File

@ -31,6 +31,7 @@ import static org.apache.solr.common.util.Utils.toJSONString;
/** /**
* ZkNodeProps contains generic immutable properties. * ZkNodeProps contains generic immutable properties.
*/ */
@SuppressWarnings({"overrides"})
public class ZkNodeProps implements JSONWriter.Writable { public class ZkNodeProps implements JSONWriter.Writable {
protected final Map<String,Object> propMap; protected final Map<String,Object> propMap;
@ -91,6 +92,7 @@ public class ZkNodeProps implements JSONWriter.Writable {
/** /**
* Create Replica from json string that is typically stored in zookeeper. * Create Replica from json string that is typically stored in zookeeper.
*/ */
@SuppressWarnings({"unchecked"})
public static ZkNodeProps load(byte[] bytes) { public static ZkNodeProps load(byte[] bytes) {
Map<String, Object> props = null; Map<String, Object> props = null;
if (bytes[0] == 2) { if (bytes[0] == 2) {
@ -169,4 +171,8 @@ public class ZkNodeProps implements JSONWriter.Writable {
public boolean equals(Object that) { public boolean equals(Object that) {
return that instanceof ZkNodeProps && ((ZkNodeProps)that).propMap.equals(this.propMap); return that instanceof ZkNodeProps && ((ZkNodeProps)that).propMap.equals(this.propMap);
} }
// @Override
// public int hashCode() {
// throw new UnsupportedOperationException("TODO unimplemented ZkNodeProps.hashCode");
// }
} }

View File

@ -96,6 +96,7 @@ public class ImplicitSnitch extends Snitch {
} }
private void fillRole(String solrNode, SnitchContext ctx, String key) throws KeeperException, InterruptedException { private void fillRole(String solrNode, SnitchContext ctx, String key) throws KeeperException, InterruptedException {
@SuppressWarnings({"rawtypes"})
Map roles = (Map) ctx.retrieve(ZkStateReader.ROLES); // we don't want to hit the ZK for each node Map roles = (Map) ctx.retrieve(ZkStateReader.ROLES); // we don't want to hit the ZK for each node
// so cache and reuse // so cache and reuse
try { try {
@ -106,10 +107,12 @@ public class ImplicitSnitch extends Snitch {
} }
} }
private void cacheRoles(String solrNode, SnitchContext ctx, String key, Map roles) { private void cacheRoles(String solrNode, SnitchContext ctx, String key,
@SuppressWarnings({"rawtypes"})Map roles) {
ctx.store(ZkStateReader.ROLES, roles); ctx.store(ZkStateReader.ROLES, roles);
if (roles != null) { if (roles != null) {
for (Object o : roles.entrySet()) { for (Object o : roles.entrySet()) {
@SuppressWarnings({"rawtypes"})
Map.Entry e = (Map.Entry) o; Map.Entry e = (Map.Entry) o;
if (e.getValue() instanceof List) { if (e.getValue() instanceof List) {
if (((List) e.getValue()).contains(solrNode)) { if (((List) e.getValue()).contains(solrNode)) {

View File

@ -23,6 +23,7 @@ import java.util.Set;
* *
*/ */
public abstract class Snitch { public abstract class Snitch {
@SuppressWarnings({"rawtypes"})
public static final Set<Class> WELL_KNOWN_SNITCHES = Collections.singleton(ImplicitSnitch.class); public static final Set<Class> WELL_KNOWN_SNITCHES = Collections.singleton(ImplicitSnitch.class);
public abstract void getTags(String solrNode, Set<String> requestedTags, SnitchContext ctx); public abstract void getTags(String solrNode, Set<String> requestedTags, SnitchContext ctx);

View File

@ -64,6 +64,7 @@ public abstract class SnitchContext implements RemoteCallback {
return Collections.emptyMap(); return Collections.emptyMap();
} }
@SuppressWarnings({"rawtypes"})
public abstract Map getZkJson(String path) throws KeeperException, InterruptedException; public abstract Map getZkJson(String path) throws KeeperException, InterruptedException;
public String getNode() { public String getNode() {

View File

@ -70,6 +70,7 @@ public class CommandOperation {
commandData = o; commandData = o;
} }
@SuppressWarnings({"unchecked"})
public Map<String, Object> getDataMap() { public Map<String, Object> getDataMap() {
if (commandData instanceof Map) { if (commandData instanceof Map) {
//noinspection unchecked //noinspection unchecked
@ -100,6 +101,7 @@ public class CommandOperation {
return commandData; return commandData;
} }
if (commandData instanceof Map) { if (commandData instanceof Map) {
@SuppressWarnings({"rawtypes"})
Map metaData = (Map) commandData; Map metaData = (Map) commandData;
return metaData.get(key); return metaData.get(key);
} else { } else {
@ -170,6 +172,7 @@ public class CommandOperation {
return s; return s;
} }
@SuppressWarnings({"rawtypes"})
private Map errorDetails() { private Map errorDetails() {
return Utils.makeMap(name, commandData, ERR_MSGS, errors); return Utils.makeMap(name, commandData, ERR_MSGS, errors);
} }
@ -207,6 +210,7 @@ public class CommandOperation {
public static final String ERR_MSGS = "errorMessages"; public static final String ERR_MSGS = "errorMessages";
public static final String ROOT_OBJ = ""; public static final String ROOT_OBJ = "";
@SuppressWarnings({"rawtypes"})
public static List<Map> captureErrors(List<CommandOperation> ops) { public static List<Map> captureErrors(List<CommandOperation> ops) {
List<Map> errors = new ArrayList<>(); List<Map> errors = new ArrayList<>();
for (CommandOperation op : ops) { for (CommandOperation op : ops) {
@ -226,6 +230,7 @@ public class CommandOperation {
* Parse the command operations into command objects from javabin payload * Parse the command operations into command objects from javabin payload
* * @param singletonCommands commands that cannot be repeated * * @param singletonCommands commands that cannot be repeated
*/ */
@SuppressWarnings({"unchecked", "rawtypes"})
public static List<CommandOperation> parse(InputStream in, Set<String> singletonCommands) throws IOException { public static List<CommandOperation> parse(InputStream in, Set<String> singletonCommands) throws IOException {
List<CommandOperation> operations = new ArrayList<>(); List<CommandOperation> operations = new ArrayList<>();
@ -288,6 +293,7 @@ public class CommandOperation {
ev = parser.nextEvent(); ev = parser.nextEvent();
Object val = ob.getVal(); Object val = ob.getVal();
if (val instanceof List && !singletonCommands.contains(key)) { if (val instanceof List && !singletonCommands.contains(key)) {
@SuppressWarnings({"rawtypes"})
List list = (List) val; List list = (List) val;
for (Object o : list) { for (Object o : list) {
if (!(o instanceof Map)) { if (!(o instanceof Map)) {
@ -308,6 +314,7 @@ public class CommandOperation {
return new CommandOperation(name, commandData); return new CommandOperation(name, commandData);
} }
@SuppressWarnings({"rawtypes"})
public Map getMap(String key, Map def) { public Map getMap(String key, Map def) {
Object o = getMapVal(key); Object o = getMapVal(key);
if (o == null) return def; if (o == null) return def;
@ -325,7 +332,8 @@ public class CommandOperation {
return new String(toJSON(singletonMap(name, commandData)), StandardCharsets.UTF_8); return new String(toJSON(singletonMap(name, commandData)), StandardCharsets.UTF_8);
} }
public static List<CommandOperation> readCommands(Iterable<ContentStream> streams, NamedList resp) throws IOException { public static List<CommandOperation> readCommands(Iterable<ContentStream> streams,
@SuppressWarnings({"rawtypes"})NamedList resp) throws IOException {
return readCommands(streams, resp, Collections.emptySet()); return readCommands(streams, resp, Collections.emptySet());
} }
@ -339,7 +347,9 @@ public class CommandOperation {
* @return parsed list of commands * @return parsed list of commands
* @throws IOException if there is an error while parsing the stream * @throws IOException if there is an error while parsing the stream
*/ */
public static List<CommandOperation> readCommands(Iterable<ContentStream> streams, NamedList resp, Set<String> singletonCommands) @SuppressWarnings({"unchecked"})
public static List<CommandOperation> readCommands(Iterable<ContentStream> streams,
@SuppressWarnings({"rawtypes"})NamedList resp, Set<String> singletonCommands)
throws IOException { throws IOException {
if (streams == null) { if (streams == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream"); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
@ -353,6 +363,7 @@ public class CommandOperation {
ops.addAll(parse(stream.getReader(), singletonCommands)); ops.addAll(parse(stream.getReader(), singletonCommands));
} }
} }
@SuppressWarnings({"rawtypes"})
List<Map> errList = CommandOperation.captureErrors(ops); List<Map> errList = CommandOperation.captureErrors(ops);
if (!errList.isEmpty()) { if (!errList.isEmpty()) {
resp.add(CommandOperation.ERR_MSGS, errList); resp.add(CommandOperation.ERR_MSGS, errList);

View File

@ -313,7 +313,8 @@ public abstract class ContentStreamBase implements ContentStream
public void setSourceInfo(String sourceInfo) { public void setSourceInfo(String sourceInfo) {
this.sourceInfo = sourceInfo; this.sourceInfo = sourceInfo;
} }
public static ContentStream create(RequestWriter requestWriter, SolrRequest req) throws IOException { public static ContentStream create(RequestWriter requestWriter,
@SuppressWarnings({"rawtypes"})SolrRequest req) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
RequestWriter.ContentWriter contentWriter = requestWriter.getContentWriter(req); RequestWriter.ContentWriter contentWriter = requestWriter.getContentWriter(req);
contentWriter.write(baos); contentWriter.write(baos);

View File

@ -184,9 +184,11 @@ public class ExecutorUtil {
final String submitterContextStr = ctxStr.length() <= MAX_THREAD_NAME_LEN ? ctxStr : ctxStr.substring(0, MAX_THREAD_NAME_LEN); final String submitterContextStr = ctxStr.length() <= MAX_THREAD_NAME_LEN ? ctxStr : ctxStr.substring(0, MAX_THREAD_NAME_LEN);
final Exception submitterStackTrace = enableSubmitterStackTrace ? new Exception("Submitter stack trace") : null; final Exception submitterStackTrace = enableSubmitterStackTrace ? new Exception("Submitter stack trace") : null;
final List<InheritableThreadLocalProvider> providersCopy = providers; final List<InheritableThreadLocalProvider> providersCopy = providers;
@SuppressWarnings({"rawtypes"})
final ArrayList<AtomicReference> ctx = providersCopy.isEmpty() ? null : new ArrayList<>(providersCopy.size()); final ArrayList<AtomicReference> ctx = providersCopy.isEmpty() ? null : new ArrayList<>(providersCopy.size());
if (ctx != null) { if (ctx != null) {
for (int i = 0; i < providers.size(); i++) { for (int i = 0; i < providers.size(); i++) {
@SuppressWarnings({"rawtypes"})
AtomicReference reference = new AtomicReference(); AtomicReference reference = new AtomicReference();
ctx.add(reference); ctx.add(reference);
providersCopy.get(i).store(reference); providersCopy.get(i).store(reference);

View File

@ -239,6 +239,7 @@ public class Hash {
/** Returns the MurmurHash3_x86_32 hash. /** Returns the MurmurHash3_x86_32 hash.
* Original source/tests at https://github.com/yonik/java_util/ * Original source/tests at https://github.com/yonik/java_util/
*/ */
@SuppressWarnings({"fallthrough"})
public static int murmurhash3_x86_32(byte[] data, int offset, int len, int seed) { public static int murmurhash3_x86_32(byte[] data, int offset, int len, int seed) {
final int c1 = 0xcc9e2d51; final int c1 = 0xcc9e2d51;
@ -456,6 +457,7 @@ public class Hash {
/** Returns the MurmurHash3_x64_128 hash, placing the result in "out". */ /** Returns the MurmurHash3_x64_128 hash, placing the result in "out". */
@SuppressWarnings({"fallthrough"})
public static void murmurhash3_x64_128(byte[] key, int offset, int len, int seed, LongPair out) { public static void murmurhash3_x64_128(byte[] key, int offset, int len, int seed, LongPair out) {
// The original algorithm does have a 32 bit unsigned seed. // The original algorithm does have a 32 bit unsigned seed.
// We have to mask to match the behavior of the unsigned types and prevent sign extension. // We have to mask to match the behavior of the unsigned types and prevent sign extension.

View File

@ -117,6 +117,7 @@ public class JsonRecordReader {
* @param r the stream reader * @param r the stream reader
* @return results a List of emitted records * @return results a List of emitted records
*/ */
@SuppressWarnings({"unchecked"})
public List<Map<String, Object>> getAllRecords(Reader r) throws IOException { public List<Map<String, Object>> getAllRecords(Reader r) throws IOException {
final List<Map<String, Object>> results = new ArrayList<>(); final List<Map<String, Object>> results = new ArrayList<>();
// Deep copy is required here because the stream might hold on to the map // Deep copy is required here because the stream might hold on to the map
@ -342,6 +343,7 @@ public class JsonRecordReader {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public void walk(int event) throws IOException { public void walk(int event) throws IOException {
if (event == OBJECT_START) { if (event == OBJECT_START) {
walkObject(); walkObject();
@ -352,6 +354,7 @@ public class JsonRecordReader {
// ensure that the value is of type List // ensure that the value is of type List
final Object val = values.get(name); final Object val = values.get(name);
if (val != null && !(val instanceof List)) { if (val != null && !(val instanceof List)) {
@SuppressWarnings({"rawtypes"})
final ArrayList listVal = new ArrayList(1); final ArrayList listVal = new ArrayList(1);
listVal.add(val); listVal.add(val);
values.put(name, listVal); values.put(name, listVal);
@ -446,6 +449,7 @@ public class JsonRecordReader {
} }
} }
@SuppressWarnings({"unchecked"})
private void addChildDoc2ParentDoc(Map<String, Object> record, Map<String, Object> values, String key) { private void addChildDoc2ParentDoc(Map<String, Object> record, Map<String, Object> values, String key) {
record = Utils.getDeepCopy(record, 2); record = Utils.getDeepCopy(record, 2);
Object oldVal = values.get(key); Object oldVal = values.get(key);
@ -454,6 +458,7 @@ public class JsonRecordReader {
} else if (oldVal instanceof List) { } else if (oldVal instanceof List) {
((List) oldVal).add(record); ((List) oldVal).add(record);
} else { } else {
@SuppressWarnings({"rawtypes"})
ArrayList l = new ArrayList(); ArrayList l = new ArrayList();
l.add(oldVal); l.add(oldVal);
l.add(record); l.add(record);
@ -476,6 +481,7 @@ public class JsonRecordReader {
} }
@SuppressWarnings({"unchecked"})
private void putValue(Map<String, Object> values, String fieldName, Object o) { private void putValue(Map<String, Object> values, String fieldName, Object o) {
if (o == null) return; if (o == null) return;
Object val = values.get(fieldName); Object val = values.get(fieldName);
@ -484,10 +490,12 @@ public class JsonRecordReader {
return; return;
} }
if (val instanceof List) { if (val instanceof List) {
@SuppressWarnings({"rawtypes"})
List list = (List) val; List list = (List) val;
list.add(o); list.add(o);
return; return;
} }
@SuppressWarnings({"rawtypes"})
ArrayList l = new ArrayList(); ArrayList l = new ArrayList();
l.add(val); l.add(val);
l.add(o); l.add(o);
@ -602,9 +610,11 @@ public class JsonRecordReader {
public abstract void walk(int event) throws IOException; public abstract void walk(int event) throws IOException;
} }
@SuppressWarnings({"unchecked"})
public static List<Object> parseArrayFieldValue(int ev, JSONParser parser, MethodFrameWrapper runnable) throws IOException { public static List<Object> parseArrayFieldValue(int ev, JSONParser parser, MethodFrameWrapper runnable) throws IOException {
assert ev == ARRAY_START; assert ev == ARRAY_START;
@SuppressWarnings({"rawtypes"})
ArrayList lst = new ArrayList(2); ArrayList lst = new ArrayList(2);
for (; ; ) { for (; ; ) {
ev = parser.nextEvent(); ev = parser.nextEvent();

View File

@ -36,6 +36,7 @@ import org.apache.solr.common.annotation.JsonProperty;
*/ */
public class JsonSchemaCreator { public class JsonSchemaCreator {
@SuppressWarnings({"rawtypes"})
public static final Map<Class, String> natives = new HashMap<>(); public static final Map<Class, String> natives = new HashMap<>();
static { static {
@ -67,7 +68,7 @@ public class JsonSchemaCreator {
return map; return map;
} }
private static void createObjectSchema(Class klas, Map<String, Object> map) { private static void createObjectSchema(@SuppressWarnings({"rawtypes"})Class klas, Map<String, Object> map) {
map.put("type", "object"); map.put("type", "object");
Map<String, Object> props = new HashMap<>(); Map<String, Object> props = new HashMap<>();
map.put("properties", props); map.put("properties", props);

View File

@ -37,11 +37,12 @@ public class RetryUtil {
boolean execute(); boolean execute();
} }
public static void retryOnThrowable(Class clazz, long timeoutms, long intervalms, RetryCmd cmd) throws Throwable { public static void retryOnThrowable(@SuppressWarnings({"rawtypes"})Class clazz, long timeoutms, long intervalms, RetryCmd cmd) throws Throwable {
retryOnThrowable(Collections.singleton(clazz), timeoutms, intervalms, cmd); retryOnThrowable(Collections.singleton(clazz), timeoutms, intervalms, cmd);
} }
public static void retryOnThrowable(Set<Class> classes, long timeoutms, long intervalms, RetryCmd cmd) throws Throwable { public static void retryOnThrowable(@SuppressWarnings({"rawtypes"})Set<Class> classes,
long timeoutms, long intervalms, RetryCmd cmd) throws Throwable {
long timeout = System.nanoTime() + TimeUnit.NANOSECONDS.convert(timeoutms, TimeUnit.MILLISECONDS); long timeout = System.nanoTime() + TimeUnit.NANOSECONDS.convert(timeoutms, TimeUnit.MILLISECONDS);
while (true) { while (true) {
try { try {
@ -61,8 +62,8 @@ public class RetryUtil {
} }
} }
private static boolean isInstanceOf(Set<Class> classes, Throwable t) { private static boolean isInstanceOf(@SuppressWarnings({"rawtypes"})Set<Class> classes, Throwable t) {
for (Class c : classes) { for (@SuppressWarnings({"rawtypes"})Class c : classes) {
if (c.isInstance(t)) { if (c.isInstance(t)) {
return true; return true;
} }

View File

@ -40,6 +40,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableSet; import static java.util.Collections.unmodifiableSet;
@SuppressWarnings({"overrides"})
public class ValidatingJsonMap implements Map<String, Object>, NavigableObject { public class ValidatingJsonMap implements Map<String, Object>, NavigableObject {
private static final String INCLUDE = "#include"; private static final String INCLUDE = "#include";
@ -347,6 +348,11 @@ public class ValidatingJsonMap implements Map<String, Object>, NavigableObject {
return that instanceof Map && this.delegate.equals(that); return that instanceof Map && this.delegate.equals(that);
} }
// @Override
// public int hashCode() {
// throw new UnsupportedOperationException("TODO unimplemented ValidatingJsonMap.hashCode");
// }
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked"})
public static final ValidatingJsonMap EMPTY = new ValidatingJsonMap(Collections.EMPTY_MAP); public static final ValidatingJsonMap EMPTY = new ValidatingJsonMap(Collections.EMPTY_MAP);