You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/06/02 13:22:29 UTC
[lucene-solr] branch branch_8x updated: SOLR-14526: fix or suppress
warnings in apache/solr/core
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 10ca1e7 SOLR-14526: fix or suppress warnings in apache/solr/core
10ca1e7 is described below
commit 10ca1e78707f009f41a15e74bc185cf60ae0090e
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Tue Jun 2 09:21:36 2020 -0400
SOLR-14526: fix or suppress warnings in apache/solr/core
---
solr/CHANGES.txt | 3 +++
.../solr/core/AbstractSolrEventListener.java | 5 +++-
.../java/org/apache/solr/core/BlobRepository.java | 9 ++++++--
.../apache/solr/core/CachingDirectoryFactory.java | 2 +-
.../java/org/apache/solr/core/CodecFactory.java | 2 +-
.../java/org/apache/solr/core/ConfigOverlay.java | 14 +++++++++++
.../src/java/org/apache/solr/core/ConfigSet.java | 3 +++
.../org/apache/solr/core/ConfigSetProperties.java | 2 ++
.../org/apache/solr/core/ConfigSetService.java | 3 +++
.../java/org/apache/solr/core/CoreContainer.java | 11 ++++++++-
.../org/apache/solr/core/HdfsDirectoryFactory.java | 2 +-
.../solr/core/IndexDeletionPolicyWrapper.java | 4 ++--
.../org/apache/solr/core/IndexReaderFactory.java | 2 +-
.../src/java/org/apache/solr/core/InitParams.java | 12 ++++++++--
.../org/apache/solr/core/MMapDirectoryFactory.java | 1 +
.../java/org/apache/solr/core/MemClassLoader.java | 5 +++-
.../solr/core/NRTCachingDirectoryFactory.java | 1 +
.../src/java/org/apache/solr/core/PluginBag.java | 27 ++++++++++++++--------
.../src/java/org/apache/solr/core/PluginInfo.java | 6 ++++-
.../org/apache/solr/core/QuerySenderListener.java | 1 +
.../java/org/apache/solr/core/RequestParams.java | 22 +++++++++++++++++-
.../org/apache/solr/core/SchemaCodecFactory.java | 1 +
.../apache/solr/core/SimpleTextCodecFactory.java | 1 +
.../src/java/org/apache/solr/core/SolrConfig.java | 7 ++++++
.../src/java/org/apache/solr/core/SolrCore.java | 14 ++++++++---
.../org/apache/solr/core/SolrDeletionPolicy.java | 2 +-
.../org/apache/solr/core/SolrResourceLoader.java | 13 +++++++----
.../solr/core/TransientSolrCoreCacheDefault.java | 6 ++++-
.../backup/repository/HdfsBackupRepository.java | 1 +
.../repository/LocalFileSystemRepository.java | 3 ++-
.../solr/core/snapshots/SolrSnapshotManager.java | 4 +++-
.../solr/core/snapshots/SolrSnapshotsTool.java | 1 +
.../solr/handler/admin/CoreAdminHandler.java | 2 +-
.../java/org/apache/solr/update/SolrCoreState.java | 3 ++-
34 files changed, 157 insertions(+), 38 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f975e08..62c28c2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -199,6 +199,9 @@ Other Changes
* SOLR-14474: Fix remaining auxilliary class warnings in Solr (Erick Erickson)
* SOLR-14519: Fix or suppress warnings in solr/cloud/autoscaling/ (Erick Erickson)
+
+* SOLR-14526: fix or suppress warnings in apache/solr/core (Erick Erickson)
+
================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/core/src/java/org/apache/solr/core/AbstractSolrEventListener.java b/solr/core/src/java/org/apache/solr/core/AbstractSolrEventListener.java
index 83b2a93..9d27874 100644
--- a/solr/core/src/java/org/apache/solr/core/AbstractSolrEventListener.java
+++ b/solr/core/src/java/org/apache/solr/core/AbstractSolrEventListener.java
@@ -29,11 +29,13 @@ public class AbstractSolrEventListener implements SolrEventListener {
public AbstractSolrEventListener(SolrCore core) {
this.core = core;
}
+ @SuppressWarnings({"rawtypes"})
private NamedList args;
+ @SuppressWarnings({"rawtypes"})
public NamedList getArgs() { return args; }
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
this.args = args.clone();
}
@@ -67,6 +69,7 @@ public class AbstractSolrEventListener implements SolrEventListener {
* @param currentSearcher If null, add FIRST_SEARCHER, otherwise NEW_SEARCHER
* @param nlst The named list to add the EVENT value to
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected NamedList addEventParms(SolrIndexSearcher currentSearcher, NamedList nlst) {
NamedList result = new NamedList();
result.addAll(nlst);
diff --git a/solr/core/src/java/org/apache/solr/core/BlobRepository.java b/solr/core/src/java/org/apache/solr/core/BlobRepository.java
index a8cc79c..4b1f702 100644
--- a/solr/core/src/java/org/apache/solr/core/BlobRepository.java
+++ b/solr/core/src/java/org/apache/solr/core/BlobRepository.java
@@ -83,9 +83,11 @@ public class BlobRepository {
}
private final CoreContainer coreContainer;
+ @SuppressWarnings({"rawtypes"})
private Map<String, BlobContent> blobs = createMap();
// for unit tests to override
+ @SuppressWarnings({"rawtypes"})
ConcurrentHashMap<String, BlobContent> createMap() {
return new ConcurrentHashMap<>();
}
@@ -122,8 +124,9 @@ public class BlobRepository {
return getBlobIncRef(key.concat(decoder.getName()), () -> addBlob(key, decoder));
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
BlobContentRef getBlobIncRef(String key, Decoder decoder, String url, String sha512) {
- StringBuffer keyBuilder = new StringBuffer(key);
+ StringBuilder keyBuilder = new StringBuilder(key);
if (decoder != null) keyBuilder.append(decoder.getName());
keyBuilder.append("/").append(sha512);
@@ -131,6 +134,7 @@ public class BlobRepository {
}
// do the actual work returning the appropriate type...
+ @SuppressWarnings({"unchecked"})
private <T> BlobContentRef<T> getBlobIncRef(String key, Callable<BlobContent<T>> blobCreator) {
BlobContent<T> aBlob;
if (this.coreContainer.isZooKeeperAware()) {
@@ -277,7 +281,7 @@ public class BlobRepository {
*
* @param ref The reference that is already there. Doing multiple calls with same ref will not matter
*/
- public void decrementBlobRefCount(BlobContentRef ref) {
+ public void decrementBlobRefCount(@SuppressWarnings({"rawtypes"})BlobContentRef ref) {
if (ref == null) return;
synchronized (ref.blob.references) {
if (!ref.blob.references.remove(ref)) {
@@ -289,6 +293,7 @@ public class BlobRepository {
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static class BlobContent<T> {
public final String key;
private final T content; // holds byte buffer or cached object, holding both is a waste of memory
diff --git a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
index 3411325..732b82c 100644
--- a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
@@ -397,7 +397,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
}
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings("rawtypes") NamedList args) {
maxWriteMBPerSecFlush = (Double) args.get("maxWriteMBPerSecFlush");
maxWriteMBPerSecMerge = (Double) args.get("maxWriteMBPerSecMerge");
maxWriteMBPerSecRead = (Double) args.get("maxWriteMBPerSecRead");
diff --git a/solr/core/src/java/org/apache/solr/core/CodecFactory.java b/solr/core/src/java/org/apache/solr/core/CodecFactory.java
index 36c67eb..7ded169 100644
--- a/solr/core/src/java/org/apache/solr/core/CodecFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/CodecFactory.java
@@ -25,7 +25,7 @@ import org.apache.solr.util.plugin.NamedListInitializedPlugin;
*/
public abstract class CodecFactory implements NamedListInitializedPlugin {
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
}
public abstract Codec getCodec();
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java b/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java
index 687505e..7e05b2d 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java
@@ -41,6 +41,7 @@ public class ConfigOverlay implements MapSerializable {
private Map<String, Object> props;
private Map<String, Object> userProps;
+ @SuppressWarnings({"unchecked"})
public ConfigOverlay(Map<String, Object> jsonObj, int znodeVersion) {
if (jsonObj == null) jsonObj = Collections.EMPTY_MAP;
this.znodeVersion = znodeVersion;
@@ -61,7 +62,9 @@ public class ConfigOverlay implements MapSerializable {
return Utils.getObjectByPath(props, onlyPrimitive, hierarchy);
}
+ @SuppressWarnings({"unchecked"})
public ConfigOverlay setUserProperty(String key, Object val) {
+ @SuppressWarnings({"rawtypes"})
Map copy = new LinkedHashMap(userProps);
copy.put(key, val);
Map<String, Object> jsonObj = new LinkedHashMap<>(this.data);
@@ -71,6 +74,7 @@ public class ConfigOverlay implements MapSerializable {
public ConfigOverlay unsetUserProperty(String key) {
if (!userProps.containsKey(key)) return this;
+ @SuppressWarnings({"unchecked", "rawtypes"})
Map copy = new LinkedHashMap(userProps);
copy.remove(key);
Map<String, Object> jsonObj = new LinkedHashMap<>(this.data);
@@ -78,6 +82,7 @@ public class ConfigOverlay implements MapSerializable {
return new ConfigOverlay(jsonObj, znodeVersion);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public ConfigOverlay setProperty(String name, Object val) {
List<String> hierarchy = checkEditable(name, false, true);
Map deepCopy = (Map) Utils.fromJSON(Utils.toJSON(props));
@@ -114,6 +119,7 @@ public class ConfigOverlay implements MapSerializable {
}
+ @SuppressWarnings({"rawtypes"})
public ConfigOverlay unsetProperty(String name) {
List<String> hierarchy = checkEditable(name, false, true);
Map deepCopy = (Map) Utils.fromJSON(Utils.toJSON(props));
@@ -164,6 +170,7 @@ public class ConfigOverlay implements MapSerializable {
//The path maps to the xml xpath and value of 1 means it is a tag with a string value and value
// of 0 means it is an attribute with string value
+ @SuppressWarnings({"rawtypes"})
private static Map editable_prop_map = (Map) Utils.fromJSONResource("EditableSolrConfigAttributes.json");
public static boolean isEditableProp(String path, boolean isXpath, List<String> hierarchy) {
@@ -171,6 +178,7 @@ public class ConfigOverlay implements MapSerializable {
}
+ @SuppressWarnings({"rawtypes"})
public static Class checkEditable(String path, boolean isXpath, List<String> hierarchy) {
List<String> parts = StrUtils.splitSmart(path, isXpath ? '/' : '.');
Object obj = editable_prop_map;
@@ -195,8 +203,10 @@ public class ConfigOverlay implements MapSerializable {
return null;
}
+ @SuppressWarnings({"rawtypes"})
static Class[] types = new Class[]{String.class, Boolean.class, Integer.class, Float.class};
+ @SuppressWarnings({"rawtypes"})
private static Class checkType(Object o, boolean isXpath, boolean isAttr) {
if (o instanceof Long) {
Long aLong = (Long) o;
@@ -209,6 +219,7 @@ public class ConfigOverlay implements MapSerializable {
}
}
+ @SuppressWarnings({"unchecked"})
public Map<String, String> getEditableSubProperties(String xpath) {
Object o = Utils.getObjectByPath(props, false, StrUtils.splitSmart(xpath, '/'));
if (o instanceof Map) {
@@ -229,6 +240,7 @@ public class ConfigOverlay implements MapSerializable {
return map;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Map> getNamedPlugins(String typ) {
Map<String, Map> reqHandlers = (Map<String, Map>) data.get(typ);
if (reqHandlers == null) return Collections.EMPTY_MAP;
@@ -236,6 +248,7 @@ public class ConfigOverlay implements MapSerializable {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public ConfigOverlay addNamedPlugin(Map<String, Object> info, String typ) {
Map dataCopy = Utils.getDeepCopy(data, 4);
Map existing = (Map) dataCopy.get(typ);
@@ -244,6 +257,7 @@ public class ConfigOverlay implements MapSerializable {
return new ConfigOverlay(dataCopy, this.znodeVersion);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public ConfigOverlay deleteNamedPlugin(String name, String typ) {
Map dataCopy = Utils.getDeepCopy(data, 4);
Map reqHandler = (Map) dataCopy.get(typ);
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSet.java b/solr/core/src/java/org/apache/solr/core/ConfigSet.java
index 671f81a..d6cb31d 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSet.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSet.java
@@ -32,10 +32,12 @@ public class ConfigSet {
private final IndexSchema indexSchema;
+ @SuppressWarnings({"rawtypes"})
private final NamedList properties;
private final boolean trusted;
+ @SuppressWarnings({"rawtypes"})
public ConfigSet(String name, SolrConfig solrConfig, IndexSchema indexSchema,
NamedList properties, boolean trusted) {
this.name = name;
@@ -57,6 +59,7 @@ public class ConfigSet {
return indexSchema;
}
+ @SuppressWarnings({"rawtypes"})
public NamedList getProperties() {
return properties;
}
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java b/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
index feaef8f..a8ca1ec 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSetProperties.java
@@ -52,6 +52,7 @@ public class ConfigSetProperties {
* @param name the name of the config set properties file
* @return the properties in a NamedList
*/
+ @SuppressWarnings({"rawtypes"})
public static NamedList readFromResourceLoader(SolrResourceLoader loader, String name) {
InputStreamReader reader;
try {
@@ -72,6 +73,7 @@ public class ConfigSetProperties {
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static NamedList readFromInputStream(InputStreamReader reader) {
try {
Object object = fromJSON(reader);
diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSetService.java b/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
index 3a258bd..721596b 100644
--- a/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
+++ b/solr/core/src/java/org/apache/solr/core/ConfigSetService.java
@@ -61,6 +61,7 @@ public abstract class ConfigSetService {
* @param dcore the core's CoreDescriptor
* @return a ConfigSet
*/
+ @SuppressWarnings({"rawtypes"})
public final ConfigSet loadConfigSet(CoreDescriptor dcore) {
SolrResourceLoader coreLoader = createCoreResourceLoader(dcore);
@@ -158,6 +159,7 @@ public abstract class ConfigSetService {
* @param loader the core's resource loader
* @return the ConfigSet properties
*/
+ @SuppressWarnings({"rawtypes"})
protected NamedList loadConfigSetProperties(CoreDescriptor cd, SolrResourceLoader loader) {
return ConfigSetProperties.readFromResourceLoader(loader, cd.getConfigSetPropertiesName());
}
@@ -166,6 +168,7 @@ public abstract class ConfigSetService {
* Return the ConfigSet flags or null if none.
*/
// TODO should fold into configSetProps -- SOLR-14059
+ @SuppressWarnings({"rawtypes"})
protected NamedList loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
return null;
}
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 6bb108b..6625f09 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -188,6 +188,7 @@ public class CoreContainer {
private final OrderedExecutor replayUpdatesExecutor;
+ @SuppressWarnings({"rawtypes"})
protected volatile LogWatcher logging = null;
private volatile CloserThread backgroundCloser = null;
@@ -335,6 +336,7 @@ public class CoreContainer {
new SolrNamedThreadFactory("replayUpdatesExecutor")));
}
+ @SuppressWarnings({"unchecked"})
private synchronized void initializeAuthorizationPlugin(Map<String, Object> authorizationConf) {
authorizationConf = Utils.getDeepCopy(authorizationConf, 4);
int newVersion = readVersion(authorizationConf);
@@ -369,6 +371,7 @@ public class CoreContainer {
}
}
+ @SuppressWarnings({"unchecked"})
private void initializeAuditloggerPlugin(Map<String, Object> auditConf) {
auditConf = Utils.getDeepCopy(auditConf, 4);
int newVersion = readVersion(auditConf);
@@ -404,6 +407,7 @@ public class CoreContainer {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private synchronized void initializeAuthenticationPlugin(Map<String, Object> authenticationConfig) {
authenticationConfig = Utils.getDeepCopy(authenticationConfig, 4);
int newVersion = readVersion(authenticationConfig);
@@ -502,6 +506,7 @@ public class CoreContainer {
}
}
+ @SuppressWarnings({"rawtypes"})
private static int readVersion(Map<String, Object> conf) {
if (conf == null) return -1;
Map meta = (Map) conf.get("");
@@ -853,6 +858,7 @@ public class CoreContainer {
}
// MetricsHistoryHandler supports both cloud and standalone configs
+ @SuppressWarnings({"unchecked"})
private void createMetricsHistoryHandler() {
PluginInfo plugin = cfg.getMetricsConfig().getHistoryHandler();
Map<String, Object> initArgs;
@@ -905,6 +911,7 @@ public class CoreContainer {
/**
* Make sure securityConfHandler is initialized
*/
+ @SuppressWarnings({"unchecked"})
private void reloadSecurityProperties() {
SecurityConfHandler.SecurityConfig securityConfig = securityConfHandler.getSecurityConfig(false);
initializeAuthorizationPlugin((Map<String, Object>) securityConfig.getData().get("authorization"));
@@ -1615,7 +1622,7 @@ public class CoreContainer {
} catch (SolrCoreState.CoreIsClosedException e) {
throw e;
} catch (Exception e) {
- coreInitFailures.put(cd.getName(), new CoreLoadFailure(cd, (Exception) e));
+ coreInitFailures.put(cd.getName(), new CoreLoadFailure(cd, e));
throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to reload core [" + cd.getName() + "]", e);
} finally {
if (!success && newCore != null && newCore.getOpenCount() > 0) {
@@ -1849,6 +1856,7 @@ public class CoreContainer {
// ---------------- CoreContainer request handlers --------------
+ @SuppressWarnings({"rawtypes"})
protected <T> T createHandler(String path, String handlerClass, Class<T> clazz) {
T handler = loader.newInstance(handlerClass, clazz, null, new Class[]{CoreContainer.class}, new Object[]{this});
if (handler instanceof SolrRequestHandler) {
@@ -1897,6 +1905,7 @@ public class CoreContainer {
return cfg.getManagementPath();
}
+ @SuppressWarnings({"rawtypes"})
public LogWatcher getLogging() {
return logging;
}
diff --git a/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
index 1c5eb73..6f27828 100644
--- a/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/HdfsDirectoryFactory.java
@@ -155,7 +155,7 @@ public class HdfsDirectoryFactory extends CachingDirectoryFactory implements Sol
}
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings("rawtypes") NamedList args) {
super.init(args);
params = args.toSolrParams();
this.hdfsDataDir = getConfig(HDFS_HOME, null);
diff --git a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
index 4af3b50..b6292de 100644
--- a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
+++ b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
@@ -323,7 +323,7 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
}
@Override
- public Collection getFileNames() throws IOException {
+ public Collection<String> getFileNames() throws IOException {
return delegate.getFileNames();
}
@@ -379,7 +379,7 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
}
@Override
- public Map getUserData() throws IOException {
+ public Map<String,String> getUserData() throws IOException {
return delegate.getUserData();
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java b/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
index 03e73b7..bf30d83 100644
--- a/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
@@ -35,7 +35,7 @@ public abstract class IndexReaderFactory implements NamedListInitializedPlugin {
*
*/
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings("rawtypes") NamedList args) {
Object v = args.get("setTermIndexDivisor");
if (v != null) {
throw new IllegalArgumentException("Illegal parameter 'setTermIndexDivisor'");
diff --git a/solr/core/src/java/org/apache/solr/core/InitParams.java b/solr/core/src/java/org/apache/solr/core/InitParams.java
index 031c7b7..76b252b 100644
--- a/solr/core/src/java/org/apache/solr/core/InitParams.java
+++ b/solr/core/src/java/org/apache/solr/core/InitParams.java
@@ -39,8 +39,13 @@ public class InitParams {
public static final String TYPE = "initParams";
public final String name;
public final Set<String> paths;
- public final NamedList defaults, invariants, appends;
- private PluginInfo pluginInfo;
+ @SuppressWarnings({"rawtypes"})
+ public final NamedList defaults;
+ @SuppressWarnings({"rawtypes"})
+ public final NamedList invariants;
+ @SuppressWarnings({"rawtypes"})
+ public final NamedList appends;
+ final private PluginInfo pluginInfo;
private final Set<String> KNOWN_KEYS = ImmutableSet.of(DEFAULTS, INVARIANTS, APPENDS);
public InitParams(PluginInfo p) {
@@ -52,6 +57,7 @@ public class InitParams {
paths = Collections.unmodifiableSet(new HashSet<>(StrUtils.splitSmart(pathStr, ',')));
}
this.paths = paths;
+ @SuppressWarnings({"rawtypes"})
NamedList nl = (NamedList) p.initArgs.get(DEFAULTS);
defaults = nl == null ? null : nl.getImmutableCopy();
nl = (NamedList) p.initArgs.get(INVARIANTS);
@@ -89,6 +95,7 @@ public class InitParams {
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void apply(PluginInfo info) {
if (!info.isFromSolrConfig()) {
//if this is a component implicitly defined in code it should be overridden by initPrams
@@ -111,6 +118,7 @@ public class InitParams {
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private static void merge(NamedList first, NamedList second, NamedList sink, String name, boolean appends) {
if (first == null && second == null) return;
if (first == null) first = new NamedList();
diff --git a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
index 0c1875b..69def25 100644
--- a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
@@ -47,6 +47,7 @@ public class MMapDirectoryFactory extends StandardDirectoryFactory {
private int maxChunk;
@Override
+ @SuppressWarnings({"rawtypes"})
public void init(NamedList args) {
super.init(args);
SolrParams params = args.toSolrParams();
diff --git a/solr/core/src/java/org/apache/solr/core/MemClassLoader.java b/solr/core/src/java/org/apache/solr/core/MemClassLoader.java
index d1a3a7c..8058f21 100644
--- a/solr/core/src/java/org/apache/solr/core/MemClassLoader.java
+++ b/solr/core/src/java/org/apache/solr/core/MemClassLoader.java
@@ -44,6 +44,7 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
private boolean allJarsLoaded = false;
private final SolrResourceLoader parentLoader;
private List<PluginBag.RuntimeLib> libs = new ArrayList<>();
+ @SuppressWarnings("rawtypes")
private Map<String, Class> classCache = new HashMap<>();
private List<String> errors = new ArrayList<>();
@@ -97,6 +98,7 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
}
}
+ @SuppressWarnings({"rawtypes"})
private synchronized Class<?> loadFromRuntimeLibs(String name) throws ClassNotFoundException {
Class result = classCache.get(name);
if(result != null)
@@ -149,11 +151,12 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
}
@Override
- public void close() throws Exception {
+ public void close() {
for (PluginBag.RuntimeLib lib : libs) {
try {
lib.close();
} catch (Exception e) {
+ log.error("Error closing lib {}", lib.getName(), e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
index 789ffdb..4e1fad9 100644
--- a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java
@@ -36,6 +36,7 @@ public class NRTCachingDirectoryFactory extends StandardDirectoryFactory {
private double maxCachedMB = DEFAULT_MAX_CACHED_MB;
@Override
+ @SuppressWarnings({"rawtypes"})
public void init(NamedList args) {
super.init(args);
SolrParams params = args.toSolrParams();
diff --git a/solr/core/src/java/org/apache/solr/core/PluginBag.java b/solr/core/src/java/org/apache/solr/core/PluginBag.java
index 2937dc5..2f82ccc 100644
--- a/solr/core/src/java/org/apache/solr/core/PluginBag.java
+++ b/solr/core/src/java/org/apache/solr/core/PluginBag.java
@@ -69,6 +69,7 @@ public class PluginBag<T> implements AutoCloseable {
private final Map<String, PluginHolder<T>> registry;
private final Map<String, PluginHolder<T>> immutableRegistry;
private String def;
+ @SuppressWarnings({"rawtypes"})
private final Class klass;
private SolrCore core;
private final SolrConfig.SolrPluginInfo meta;
@@ -119,6 +120,7 @@ public class PluginBag<T> implements AutoCloseable {
/**
* Check if any of the mentioned names are missing. If yes, return the Set of missing names
*/
+ @SuppressWarnings({"unchecked"})
public Set<String> checkContains(Collection<String> names) {
if (names == null || names.isEmpty()) return Collections.EMPTY_SET;
HashSet<String> result = new HashSet<>();
@@ -126,6 +128,7 @@ public class PluginBag<T> implements AutoCloseable {
return result;
}
+ @SuppressWarnings({"unchecked"})
public PluginHolder<T> createPlugin(PluginInfo info) {
if ("true".equals(String.valueOf(info.attributes.get("runtimeLib")))) {
if (log.isDebugEnabled()) {
@@ -148,7 +151,7 @@ public class PluginBag<T> implements AutoCloseable {
PackagePluginHolder<T> holder = new PackagePluginHolder<>(info, core, meta);
return holder;
} else {
- T inst = core.createInstance(info.className, (Class<T>) meta.clazz, meta.getCleanTag(), null, core.getResourceLoader(info.pkgName));
+ T inst = SolrCore.createInstance(info.className, (Class<T>) meta.clazz, meta.getCleanTag(), null, core.getResourceLoader(info.pkgName));
initInstance(inst, info);
return new PluginHolder<>(info, inst);
}
@@ -208,6 +211,7 @@ public class PluginBag<T> implements AutoCloseable {
return old == null ? null : old.get();
}
+ @SuppressWarnings({"unchecked"})
public PluginHolder<T> put(String name, PluginHolder<T> plugin) {
Boolean registerApi = null;
Boolean disableHandler = null;
@@ -382,14 +386,21 @@ public class PluginBag<T> implements AutoCloseable {
}
@Override
- public void close() throws Exception {
+ public void close() {
// TODO: there may be a race here. One thread can be creating a plugin
// and another thread can come along and close everything (missing the plugin
// that is in the state of being created and will probably never have close() called on it).
// can close() be called concurrently with other methods?
if (isLoaded()) {
T myInst = get();
- if (myInst != null && myInst instanceof AutoCloseable) ((AutoCloseable) myInst).close();
+ // N.B. instanceof returns false if myInst is null
+ if (myInst instanceof AutoCloseable) {
+ try {
+ ((AutoCloseable) myInst).close();
+ } catch (Exception e) {
+ log.error("Error closing {}", inst , e);
+ }
+ }
}
}
@@ -459,10 +470,11 @@ public class PluginBag<T> implements AutoCloseable {
MemClassLoader loader = (MemClassLoader) resourceLoader;
loader.loadJars();
}
+ @SuppressWarnings({"unchecked"})
Class<T> clazz = (Class<T>) pluginMeta.clazz;
T localInst = null;
try {
- localInst = core.createInstance(pluginInfo.className, clazz, pluginMeta.getCleanTag(), null, resourceLoader);
+ localInst = SolrCore.createInstance(pluginInfo.className, clazz, pluginMeta.getCleanTag(), null, resourceLoader);
} catch (SolrException e) {
if (isRuntimeLib && !(resourceLoader instanceof MemClassLoader)) {
throw new SolrException(SolrException.ErrorCode.getErrorCode(e.code()),
@@ -489,8 +501,6 @@ public class PluginBag<T> implements AutoCloseable {
lazyInst = localInst; // only assign the volatile until after the plugin is completely ready to use
return true;
}
-
-
}
/**
@@ -526,9 +536,7 @@ public class PluginBag<T> implements AutoCloseable {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, StrUtils.formatString(BlobRepository.INVALID_JAR_MSG, url, sha512, digest) );
}
log.info("dynamic library verified {}, sha512: {}", url, sha512);
-
}
-
}
public RuntimeLib(SolrCore core) {
@@ -539,6 +547,7 @@ public class PluginBag<T> implements AutoCloseable {
return url;
}
+ @SuppressWarnings({"unchecked"})
void loadJar() {
if (jarContent != null) return;
synchronized (this) {
@@ -601,7 +610,7 @@ public class PluginBag<T> implements AutoCloseable {
@Override
- public void close() throws Exception {
+ public void close() {
if (jarContent != null) coreContainer.getBlobRepository().decrementBlobRefCount(jarContent);
}
diff --git a/solr/core/src/java/org/apache/solr/core/PluginInfo.java b/solr/core/src/java/org/apache/solr/core/PluginInfo.java
index bb290e1..428d72c 100644
--- a/solr/core/src/java/org/apache/solr/core/PluginInfo.java
+++ b/solr/core/src/java/org/apache/solr/core/PluginInfo.java
@@ -42,6 +42,7 @@ import static org.apache.solr.schema.FieldType.CLASS_NAME;
*/
public class PluginInfo implements MapSerializable {
public final String name, className, type, pkgName;
+ @SuppressWarnings({"rawtypes"})
public final NamedList initArgs;
public final Map<String, String> attributes;
public final List<PluginInfo> children;
@@ -49,7 +50,7 @@ public class PluginInfo implements MapSerializable {
- public PluginInfo(String type, Map<String, String> attrs, NamedList initArgs, List<PluginInfo> children) {
+ public PluginInfo(String type, Map<String, String> attrs, @SuppressWarnings({"rawtypes"})NamedList initArgs, List<PluginInfo> children) {
this.type = type;
this.name = attrs.get(NAME);
Pair<String, String> parsed = parseClassName(attrs.get(CLASS_NAME));
@@ -92,6 +93,7 @@ public class PluginInfo implements MapSerializable {
isFromSolrConfig = true;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public PluginInfo(String type, Map<String,Object> map) {
LinkedHashMap m = new LinkedHashMap<>(map);
initArgs = new NamedList();
@@ -163,6 +165,7 @@ public class PluginInfo implements MapSerializable {
return l.isEmpty() ? null:l.get(0);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Object> toMap(Map<String, Object> map) {
map.putAll(attributes);
Map m = map;
@@ -197,6 +200,7 @@ public class PluginInfo implements MapSerializable {
for (PluginInfo child : children) if(type.equals(child.type)) result.add(child);
return result;
}
+ @SuppressWarnings({"rawtypes"})
public static final PluginInfo EMPTY_INFO = new PluginInfo("",Collections.<String,String>emptyMap(), new NamedList(),Collections.<PluginInfo>emptyList());
private static final HashSet<String> NL_TAGS = new HashSet<>
diff --git a/solr/core/src/java/org/apache/solr/core/QuerySenderListener.java b/solr/core/src/java/org/apache/solr/core/QuerySenderListener.java
index d4bb6c0..9b75142 100644
--- a/solr/core/src/java/org/apache/solr/core/QuerySenderListener.java
+++ b/solr/core/src/java/org/apache/solr/core/QuerySenderListener.java
@@ -45,6 +45,7 @@ public class QuerySenderListener extends AbstractSolrEventListener {
}
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher) {
final SolrIndexSearcher searcher = newSearcher;
log.debug("QuerySenderListener sending requests to {}", newSearcher);
diff --git a/solr/core/src/java/org/apache/solr/core/RequestParams.java b/solr/core/src/java/org/apache/solr/core/RequestParams.java
index 9a5249b..1883953 100644
--- a/solr/core/src/java/org/apache/solr/core/RequestParams.java
+++ b/solr/core/src/java/org/apache/solr/core/RequestParams.java
@@ -47,10 +47,12 @@ import static org.apache.solr.common.util.Utils.getDeepCopy;
public class RequestParams implements MapSerializable {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ @SuppressWarnings({"rawtypes"})
private final Map data;
private final Map<String, ParamSet> paramsets = new LinkedHashMap<>();
private final int znodeVersion;
+ @SuppressWarnings({"rawtypes"})
public RequestParams(Map data, int znodeVersion) {
if (data == null) data = Collections.EMPTY_MAP;
this.data = data;
@@ -67,6 +69,7 @@ public class RequestParams implements MapSerializable {
this.znodeVersion = znodeVersion;
}
+ @SuppressWarnings({"rawtypes"})
public static ParamSet createParamSet(Map map, Long version) {
Map copy = getDeepCopy(map, 3);
Map meta = (Map) copy.remove("");
@@ -82,9 +85,13 @@ public class RequestParams implements MapSerializable {
* This converts Lists to arrays of strings. Because Solr expects
* params to be String[]
*/
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
private static Map getMapCopy(Map value) {
+ @SuppressWarnings({"rawtypes"})
Map copy = new LinkedHashMap<>();
for (Object o1 : value.entrySet()) {
+ @SuppressWarnings({"rawtypes"})
Map.Entry entry = (Map.Entry) o1;
if ("".equals(entry.getKey())) {
copy.put(entry.getKey(), entry.getValue());
@@ -92,6 +99,7 @@ public class RequestParams implements MapSerializable {
}
if (entry.getValue() != null) {
if (entry.getValue() instanceof List) {
+ @SuppressWarnings({"rawtypes"})
List l = (List) entry.getValue();
String[] sarr = new String[l.size()];
for (int i = 0; i < l.size(); i++) {
@@ -122,10 +130,12 @@ public class RequestParams implements MapSerializable {
}
@Override
+ @SuppressWarnings({"unchecked"})
public Map<String, Object> toMap(Map<String, Object> map) {
return getMapWithVersion(data, znodeVersion);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static Map<String, Object> getMapWithVersion(Map<String, Object> data, int znodeVersion) {
Map result = new LinkedHashMap();
result.put(ConfigOverlay.ZNODEVER, znodeVersion);
@@ -133,6 +143,7 @@ public class RequestParams implements MapSerializable {
return result;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public RequestParams setParams(String name, ParamSet paramSet) {
Map deepCopy = getDeepCopy(data, 3);
Map p = (Map) deepCopy.get(NAME);
@@ -182,6 +193,7 @@ public class RequestParams implements MapSerializable {
log.info("conf resource {} loaded . version : {} ", name, version);
}
try {
+ @SuppressWarnings({"rawtypes"})
Map m = (Map) fromJSON (in);
return new Object[]{m, version};
} catch (Exception e) {
@@ -206,10 +218,13 @@ public class RequestParams implements MapSerializable {
public static final String INVARIANTS = "_invariants_";
public static class ParamSet implements MapSerializable {
+ @SuppressWarnings({"rawtypes"})
private final Map defaults, appends, invariants;
Map<String, VersionedParams> paramsMap;
+ @SuppressWarnings({"rawtypes"})
public final Map meta;
+ @SuppressWarnings({"rawtypes"})
ParamSet(Map defaults, Map invariants, Map appends, Map meta) {
this.defaults = defaults;
this.invariants = invariants;
@@ -227,6 +242,7 @@ public class RequestParams implements MapSerializable {
}
@Override
+ @SuppressWarnings({"unchecked"})
public Map<String, Object> toMap(Map<String, Object> result) {
result.putAll(defaults);
if (appends != null) result.put(APPENDS, appends);
@@ -236,7 +252,8 @@ public class RequestParams implements MapSerializable {
}
- public ParamSet update(Map map) {
+ @SuppressWarnings({"rawtypes"})
+ public ParamSet update(@SuppressWarnings({"rawtypes"})Map map) {
ParamSet p = createParamSet(map, null);
return new ParamSet(
mergeMaps(getDeepCopy(defaults, 2), p.defaults),
@@ -246,6 +263,7 @@ public class RequestParams implements MapSerializable {
);
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private static Map mergeMaps(Map m1, Map m2) {
if (m1 == null && m2 == null) return null;
if (m1 == null) return m2;
@@ -263,6 +281,7 @@ public class RequestParams implements MapSerializable {
/**get the raw map
*/
+ @SuppressWarnings({"unchecked"})
public Map<String, Object> get() {
return defaults;
}
@@ -271,6 +290,7 @@ public class RequestParams implements MapSerializable {
public static class VersionedParams extends MapSolrParams {
final ParamSet paramSet;
+ @SuppressWarnings({"unchecked", "rawtypes"})
public VersionedParams(Map map, ParamSet paramSet) {
super(getMapCopy(map));
this.paramSet = paramSet;
diff --git a/solr/core/src/java/org/apache/solr/core/SchemaCodecFactory.java b/solr/core/src/java/org/apache/solr/core/SchemaCodecFactory.java
index 8a591c8..6fc3629 100644
--- a/solr/core/src/java/org/apache/solr/core/SchemaCodecFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/SchemaCodecFactory.java
@@ -73,6 +73,7 @@ public class SchemaCodecFactory extends CodecFactory implements SolrCoreAware {
}
@Override
+ @SuppressWarnings({"rawtypes"})
public void init(NamedList args) {
super.init(args);
assert codec == null;
diff --git a/solr/core/src/java/org/apache/solr/core/SimpleTextCodecFactory.java b/solr/core/src/java/org/apache/solr/core/SimpleTextCodecFactory.java
index de0124f..9f3929a 100644
--- a/solr/core/src/java/org/apache/solr/core/SimpleTextCodecFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/SimpleTextCodecFactory.java
@@ -25,6 +25,7 @@ public class SimpleTextCodecFactory extends CodecFactory {
private Codec codec;
@Override
+ @SuppressWarnings({"rawtypes"})
public void init(NamedList args) {
super.init(args);
assert codec == null;
diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
index 2c1ed35..55040fb 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
@@ -368,11 +368,13 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
public static class SolrPluginInfo {
+ @SuppressWarnings({"rawtypes"})
public final Class clazz;
public final String tag;
public final Set<PluginOpts> options;
+ @SuppressWarnings({"unchecked", "rawtypes"})
private SolrPluginInfo(Class clz, String tag, PluginOpts... opts) {
this.clazz = clz;
this.tag = tag;
@@ -389,6 +391,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
public static ConfigOverlay getConfigOverlay(SolrResourceLoader loader) {
InputStream in = null;
InputStreamReader isr = null;
@@ -672,6 +675,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Object> toMap(Map<String, Object> map) {
LinkedHashMap result = new LinkedHashMap();
result.put("indexWriter", makeMap("closeWaitsForMerges", indexWriterCloseWaitsForMerges));
@@ -706,6 +710,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
* SearchComponent, QueryConverter, SolrEventListener, DirectoryFactory,
* IndexDeletionPolicy, IndexReaderFactory, {@link TransformerFactory}
*/
+ @SuppressWarnings({"unchecked", "rawtypes"})
public List<PluginInfo> getPluginInfos(String type) {
List<PluginInfo> result = pluginStore.get(type);
SolrPluginInfo info = classVsSolrPluginInfo.get(type);
@@ -856,6 +861,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
}
@Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, Object> toMap(Map<String, Object> result) {
if (getZnodeVersion() > -1) result.put(ZNODEVER, getZnodeVersion());
result.put(IndexSchema.LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion);
@@ -914,6 +920,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
return result;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private void addCacheConfig(Map queryMap, CacheConfig... cache) {
if (cache == null) return;
for (CacheConfig config : cache) if (config != null) queryMap.put(config.getNodeName(), config);
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index d7791c6..8646a9f 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -197,6 +197,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
private final SolrConfig solrConfig;
private final SolrResourceLoader resourceLoader;
private volatile IndexSchema schema;
+ @SuppressWarnings({"rawtypes"})
private final NamedList configSetProperties;
private final String dataDir;
private final String ulogDir;
@@ -355,6 +356,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
this.schema = replacementSchema;
}
+ @SuppressWarnings({"rawtypes"})
public NamedList getConfigSetProperties() {
return configSetProperties;
}
@@ -2032,7 +2034,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
}
- public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, final Future[] waitSearcher) {
+ public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, @SuppressWarnings({"rawtypes"})final Future[] waitSearcher) {
return getSearcher(forceNew, returnSearcher, waitSearcher, false);
}
@@ -2228,7 +2230,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
* @param waitSearcher if non-null, will be filled in with a {@link Future} that will return after the new searcher is registered.
* @param updateHandlerReopens if true, the UpdateHandler will be used when reopening a {@link SolrIndexSearcher}.
*/
- public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, final Future[] waitSearcher, boolean updateHandlerReopens) {
+ public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, @SuppressWarnings({"rawtypes"})final Future[] waitSearcher, boolean updateHandlerReopens) {
// it may take some time to open an index.... we may need to make
// sure that two threads aren't trying to open one at the same time
// if it isn't necessary.
@@ -2335,6 +2337,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
final SolrIndexSearcher currSearcher = currSearcherHolder == null ? null : currSearcherHolder.get();
+ @SuppressWarnings({"rawtypes"})
Future future = null;
// if the underlying searcher has not changed, no warming is needed
@@ -2817,6 +2820,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
private final PluginBag<TransformerFactory> transformerFactories = new PluginBag<>(TransformerFactory.class, this);
+ @SuppressWarnings({"unchecked"})
<T> Map<String, T> createInstances(Map<String, Class<? extends T>> map) {
Map<String, T> result = new LinkedHashMap<>(map.size(), 1);
for (Map.Entry<String, Class<? extends T>> e : map.entrySet()) {
@@ -2865,7 +2869,7 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
return def;
}
- public void initDefaultPlugin(Object plugin, Class type) {
+ public void initDefaultPlugin(Object plugin, @SuppressWarnings({"rawtypes"})Class type) {
if (plugin instanceof SolrMetricProducer) {
coreMetricManager.registerMetricProducer(type.getSimpleName() + ".default", (SolrMetricProducer) plugin);
}
@@ -3183,8 +3187,10 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
}
}
+ @SuppressWarnings({"rawtypes"})
private static final Map implicitPluginsInfo = (Map) Utils.fromJSONResource("ImplicitPlugins.json");
+ @SuppressWarnings({"unchecked", "rawtypes"})
public List<PluginInfo> getImplicitHandlers() {
List<PluginInfo> implicits = new ArrayList<>();
Map requestHandlers = (Map) implicitPluginsInfo.get(SolrRequestHandler.TYPE);
@@ -3209,12 +3215,14 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
* @param decoder a decoder with which to convert the blob into a Java Object representation (first time only)
* @return a reference to the blob that has already cached the decoded version.
*/
+ @SuppressWarnings({"rawtypes"})
public BlobRepository.BlobContentRef loadDecodeAndCacheBlob(String key, BlobRepository.Decoder<Object> decoder) {
// make sure component authors don't give us oddball keys with no version...
if (!BlobRepository.BLOB_KEY_PATTERN_CHECKER.matcher(key).matches()) {
throw new IllegalArgumentException("invalid key format, must end in /N where N is the version number");
}
// define the blob
+ @SuppressWarnings({"rawtypes"})
BlobRepository.BlobContentRef blobRef = coreContainer.getBlobRepository().getBlobIncRef(key, decoder);
addCloseHook(new CloseHook() {
@Override
diff --git a/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java b/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java
index 71c69a3..6c4c9ec 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrDeletionPolicy.java
@@ -48,7 +48,7 @@ public class SolrDeletionPolicy extends IndexDeletionPolicy implements NamedList
private int maxOptimizedCommitsToKeep = 0;
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings("rawtypes") NamedList args) {
String keepOptimizedOnlyString = (String) args.get("keepOptimizedOnly");
String maxCommitsToKeepString = (String) args.get("maxCommitsToKeep");
String maxOptimizedCommitsToKeepString = (String) args.get("maxOptimizedCommitsToKeep");
diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
index 3c6318c..0fdcf71 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
@@ -542,13 +542,14 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
}
}
- static final String empty[] = new String[0];
+ static final String[] empty = new String[0];
@Override
public <T> T newInstance(String name, Class<T> expectedType) {
return newInstance(name, expectedType, empty);
}
+ @SuppressWarnings({"rawtypes"})
private static final Class[] NO_CLASSES = new Class[0];
private static final Object[] NO_OBJECTS = new Object[0];
@@ -556,6 +557,7 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
return newInstance(cname, expectedType, subpackages, NO_CLASSES, NO_OBJECTS);
}
+ @SuppressWarnings({"rawtypes"})
public <T> T newInstance(String cName, Class<T> expectedType, String [] subPackages, Class[] params, Object[] args){
Class<? extends T> clazz = findClass(cName, expectedType, subPackages);
if( clazz == null ) {
@@ -748,11 +750,12 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
/**
* Keep a list of classes that are allowed to implement each 'Aware' interface
*/
+ @SuppressWarnings({"rawtypes"})
private static final Map<Class, Class[]> awareCompatibility;
static {
awareCompatibility = new HashMap<>();
awareCompatibility.put(
- SolrCoreAware.class, new Class[] {
+ SolrCoreAware.class, new Class<?>[]{
// DO NOT ADD THINGS TO THIS LIST -- ESPECIALLY THINGS THAT CAN BE CREATED DYNAMICALLY
// VIA RUNTIME APIS -- UNTILL CAREFULLY CONSIDERING THE ISSUES MENTIONED IN SOLR-8311
CodecFactory.class,
@@ -768,7 +771,7 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
);
awareCompatibility.put(
- ResourceLoaderAware.class, new Class[] {
+ ResourceLoaderAware.class, new Class<?>[]{
// DO NOT ADD THINGS TO THIS LIST -- ESPECIALLY THINGS THAT CAN BE CREATED DYNAMICALLY
// VIA RUNTIME APIS -- UNTILL CAREFULLY CONSIDERING THE ISSUES MENTIONED IN SOLR-8311
CharFilterFactory.class,
@@ -783,8 +786,8 @@ public class SolrResourceLoader implements ResourceLoader,Closeable
/**
* Utility function to throw an exception if the class is invalid
*/
- public static void assertAwareCompatibility( Class aware, Object obj )
- {
+ @SuppressWarnings({"rawtypes"})
+ public static void assertAwareCompatibility(Class aware, Object obj) {
Class[] valid = awareCompatibility.get( aware );
if( valid == null ) {
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
diff --git a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
index c2824ae..476dca9 100644
--- a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
+++ b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
@@ -54,6 +54,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
// deprecate this for 7.0?
this.cacheSize = cfg.getTransientCacheSize();
} else {
+ @SuppressWarnings({"rawtypes"})
NamedList args = cfg.getTransientCachePluginInfo().initArgs;
Object obj = args.get("transientCacheSize");
if (obj != null) {
@@ -69,6 +70,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
// Still handle just having transientCacheSize defined in the body of solr.xml not in a transient handler clause.
this.cacheSize = cfg.getTransientCacheSize();
} else {
+ @SuppressWarnings({"rawtypes"})
NamedList args = cfg.getTransientCachePluginInfo().initArgs;
Object obj = args.get("transientCacheSize");
if (obj != null) {
@@ -103,6 +105,8 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
@Override
public Collection<SolrCore> prepareForShutdown() {
// Returna copy of the values
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
List<SolrCore> ret = new ArrayList(transientCores.values());
transientCores.clear();
return ret;
@@ -127,7 +131,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
}
// Remove a core from the internal structures, presumably it
- // being closed. If the core is re-opened, it will be readded by CoreContainer.
+ // being closed. If the core is re-opened, it will be re-added by CoreContainer.
@Override
public SolrCore removeCore(String name) {
return transientCores.remove(name);
diff --git a/solr/core/src/java/org/apache/solr/core/backup/repository/HdfsBackupRepository.java b/solr/core/src/java/org/apache/solr/core/backup/repository/HdfsBackupRepository.java
index 6c0b04c..1e9da27 100644
--- a/solr/core/src/java/org/apache/solr/core/backup/repository/HdfsBackupRepository.java
+++ b/solr/core/src/java/org/apache/solr/core/backup/repository/HdfsBackupRepository.java
@@ -49,6 +49,7 @@ public class HdfsBackupRepository implements BackupRepository {
private Configuration hdfsConfig = null;
private FileSystem fileSystem = null;
private Path baseHdfsPath = null;
+ @SuppressWarnings("rawtypes")
private NamedList config = null;
protected int copyBufferSize = HdfsDirectory.DEFAULT_BUFFER_SIZE;
diff --git a/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java b/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java
index 01810f6..bbafc97 100644
--- a/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java
+++ b/solr/core/src/java/org/apache/solr/core/backup/repository/LocalFileSystemRepository.java
@@ -46,10 +46,11 @@ import com.google.common.base.Preconditions;
* interface e.g. NFS).
*/
public class LocalFileSystemRepository implements BackupRepository {
+ @SuppressWarnings("rawtypes")
private NamedList config = null;
@Override
- public void init(NamedList args) {
+ public void init(@SuppressWarnings("rawtypes") NamedList args) {
this.config = args;
}
diff --git a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
index f40bea80..3a9fa0e 100644
--- a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
+++ b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
@@ -169,6 +169,7 @@ public class SolrSnapshotManager {
throws InterruptedException, KeeperException {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.of(commitName));
try {
+ @SuppressWarnings({"unchecked"})
Map<String, Object> data = (Map<String, Object>)Utils.fromJSON(zkClient.getData(zkPath, null, null, true));
return Optional.of(new CollectionSnapshotMetaData(data));
} catch (KeeperException ex) {
@@ -281,13 +282,14 @@ public class SolrSnapshotManager {
* @param dir The index directory storing the snapshot.
* @throws IOException in case of I/O errors.
*/
+
+ @SuppressWarnings({"try", "unused"})
private static void deleteSnapshotIndexFiles(SolrCore core, Directory dir, IndexDeletionPolicy delPolicy) throws IOException {
IndexWriterConfig conf = core.getSolrConfig().indexConfig.toIndexWriterConfig(core);
conf.setOpenMode(OpenMode.APPEND);
conf.setMergePolicy(NoMergePolicy.INSTANCE);//Don't want to merge any commits here!
conf.setIndexDeletionPolicy(delPolicy);
conf.setCodec(core.getCodec());
-
try (SolrIndexWriter iw = new SolrIndexWriter("SolrSnapshotCleaner", dir, conf)) {
// Do nothing. The only purpose of opening index writer is to invoke the Lucene IndexDeletionPolicy#onInit
// method so that we can cleanup the files associated with specified index commit.
diff --git a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotsTool.java b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotsTool.java
index 53261f5..969b552 100644
--- a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotsTool.java
+++ b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotsTool.java
@@ -424,6 +424,7 @@ public class SolrSnapshotsTool implements Closeable {
return false;
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
private Collection<CollectionSnapshotMetaData> listCollectionSnapshots(String collectionName)
throws SolrServerException, IOException {
CollectionAdminRequest.ListSnapshots listSnapshots = new CollectionAdminRequest.ListSnapshots(collectionName);
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
index f78e523..0ef3ebb 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
@@ -114,7 +114,7 @@ public class CoreAdminHandler extends RequestHandlerBase implements PermissionNa
@Override
- final public void init(NamedList args) {
+ final public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"CoreAdminHandler should not be configured in solrconf.xml\n" +
"it is a special Handler configured directly by the RequestDispatcher");
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCoreState.java b/solr/core/src/java/org/apache/solr/update/SolrCoreState.java
index 380bc9a..eddd5b7 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCoreState.java
@@ -196,9 +196,10 @@ public abstract class SolrCoreState {
public abstract void setCdcrBootstrapFuture(Future<Boolean> cdcrBootstrapFuture);
+ @SuppressWarnings("rawtypes")
public abstract Callable getCdcrBootstrapCallable();
- public abstract void setCdcrBootstrapCallable(Callable cdcrBootstrapCallable);
+ public abstract void setCdcrBootstrapCallable(@SuppressWarnings("rawtypes") Callable cdcrBootstrapCallable);
public Throwable getTragicException() throws IOException {
RefCounted<IndexWriter> ref = getIndexWriter(null);