Apache Solr open-source search software
SOLR-17931: Remove deprecated code (#3696)
Eric Pugh8d28b3a76fe6
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.javaindex 4a1b6ca2af9..120ad79dddc 100644--- a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java+++ b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java@@ -22,8 +22,6 @@ import java.io.InputStream;import java.lang.invoke.MethodHandles;import java.nio.file.FileSystems;import java.nio.file.Path;-import org.apache.solr.common.SolrException.ErrorCode;-import org.apache.solr.common.cloud.ZooKeeperException;import org.apache.solr.common.util.Pair;import org.apache.solr.core.SolrResourceLoader;import org.apache.solr.core.SolrResourceNotFoundException;@@ -155,13 +153,6 @@ public class ZkSolrResourceLoader extends SolrResourceLoader {}}- @Override- public String getConfigDir() {- throw new ZooKeeperException(- ErrorCode.SERVER_ERROR,- "ZkSolrResourceLoader does not support getConfigDir() - likely, what you are trying to do is not supported in ZooKeeper mode");- }-public String getConfigSetZkPath() {return configSetZkPath;}diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.javaindex 3f3d2eda3ab..1c7ca0ee6b1 100644--- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java+++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java@@ -324,14 +324,6 @@ public class SolrResourceLoaderreturn instanceDir.resolve("conf");}- /**- * @deprecated use {@link #getConfigPath()}- */- @Deprecated(since = "9.0.0")- public String getConfigDir() {- return getConfigPath().toString();- }-/*** EXPERT*diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.javaindex 5c773811537..7d6e5ec65c0 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java@@ -20,6 +20,7 @@ import java.io.IOException;import java.io.UnsupportedEncodingException;import java.lang.invoke.MethodHandles;import java.net.URISyntaxException;+import java.net.URL;import java.nio.file.Files;import java.nio.file.Path;import java.util.Date;@@ -305,7 +306,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements PermisString fname = fnameIn.toUpperCase(Locale.ROOT);if (hiddenFiles.contains(fname) || hiddenFiles.contains("*")) {if (reportError) {- log.error("Cannot access {}", fname);rsp.setException(new SolrException(SolrException.ErrorCode.FORBIDDEN, "Can not access: " + fnameIn));}@@ -316,7 +316,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis// the effort though to fix it to handle all possibilities though.if (fname.contains("..") || fname.startsWith(".")) {if (reportError) {- log.error("Invalid path: {}", fname);rsp.setException(new SolrException(SolrException.ErrorCode.FORBIDDEN, "Invalid path: " + fnameIn));}@@ -355,7 +354,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis// Make sure the file exists, is readable and is not a hidden fileif (!zkClient.exists(adminFile, true)) {- log.error("Can not find: {}", adminFile);rsp.setException(new SolrException(SolrException.ErrorCode.NOT_FOUND, "Can not find: " + adminFile));return null;@@ -374,9 +372,17 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permisif (!Files.exists(configDir)) {// TODO: maybe we should just open it this way to start with?try {- configDir = Path.of(loader.getClassLoader().getResource(loader.getConfigDir()).toURI());+ URL configUrl = loader.getClassLoader().getResource(loader.getConfigPath().toString());+ if (configUrl == null) {+ rsp.setException(+ new SolrException(+ SolrException.ErrorCode.FORBIDDEN,+ "Configuration directory resource not found: "+ + loader.getConfigPath().toString()));+ return null;+ }+ configDir = Path.of(configUrl.toURI());} catch (URISyntaxException e) {- log.error("Can not access configuration directory!");rsp.setException(new SolrException(SolrException.ErrorCode.FORBIDDEN, "Can not access configuration directory!", e));@@ -390,7 +396,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permisfname = fname.replace('\\', '/'); // normalize slashesif (hiddenFiles.contains(fname.toUpperCase(Locale.ROOT))) {- log.error("Can not access: {}", fname);rsp.setException(new SolrException(SolrException.ErrorCode.FORBIDDEN, "Can not access: " + fname));return null;@@ -399,7 +404,6 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements PermisPath filePath = configDir.resolve(fname.startsWith("/") ? fname.substring(1) : fname);req.getCoreContainer().assertPathAllowed(filePath);if (!filePath.normalize().startsWith(configDir.normalize())) {- log.error("Path must be inside core config directory");rsp.setException(new SolrException(ErrorCode.BAD_REQUEST, "Path must be inside core config directory"));return null;diff --git a/solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java b/solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.javaindex cf226f1e6c0..a3938f92f95 100644--- a/solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java+++ b/solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java@@ -50,11 +50,6 @@ public class CPUCircuitBreaker extends CircuitBreaker implements SolrCoreAware {super();}- @Deprecated(since = "9.5")- public CPUCircuitBreaker(SolrCore core) {- this(core.getCoreContainer());- }-public CPUCircuitBreaker(CoreContainer coreContainer) {super();this.cc = coreContainer;diff --git a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.javaindex bf7068588db..9d5418adada 100644--- a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java+++ b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java@@ -100,9 +100,6 @@ public class JWTAuthPlugin extends AuthenticationPluginprivate static final long DEFAULT_REFRESH_REPRIEVE_THRESHOLD = 5000;static final String PRIMARY_ISSUER = "PRIMARY";- @Deprecated(since = "9.0") // Remove in 10.0- private static final String PARAM_ALG_WHITELIST = "algWhitelist";-private static final Set<String> PROPS =Set.of(PARAM_BLOCK_UNKNOWN,@@ -186,14 +183,6 @@ public class JWTAuthPlugin extends AuthenticationPluginrolesClaim = (String) pluginConfig.get(PARAM_ROLES_CLAIM);algAllowlist = (List<String>) pluginConfig.get(PARAM_ALG_ALLOWLIST);- // TODO: Remove deprecated warning in Solr 10.0- if ((algAllowlist == null || algAllowlist.isEmpty())- && pluginConfig.containsKey(PARAM_ALG_WHITELIST)) {- log.warn(- "Found use of deprecated parameter algWhitelist. Please use {} instead.",- PARAM_ALG_ALLOWLIST);- algAllowlist = (List<String>) pluginConfig.get(PARAM_ALG_WHITELIST);- }realm = (String) pluginConfig.getOrDefault(PARAM_REALM, DEFAULT_AUTH_REALM);Map<String, String> claimsMatch = (Map<String, String>) pluginConfig.get(PARAM_CLAIMS_MATCH);diff --git a/solr/modules/langid/src/java/org/apache/solr/update/processor/LangIdParams.java b/solr/modules/langid/src/java/org/apache/solr/update/processor/LangIdParams.javaindex 3eb55b012f1..8c3c0b646cf 100644--- a/solr/modules/langid/src/java/org/apache/solr/update/processor/LangIdParams.java+++ b/solr/modules/langid/src/java/org/apache/solr/update/processor/LangIdParams.java@@ -32,9 +32,6 @@ public interface LangIdParams {String ENFORCE_SCHEMA =LANGUAGE_ID + ".enforceSchema"; // Enforces that output fields exist in schema- @Deprecated(since = "9.0.0")- String LANG_WHITELIST = LANGUAGE_ID + ".whitelist"; // Old property name for allowed languages-String LANG_ALLOWLIST = LANGUAGE_ID + ".allowlist"; // Allowed languagesString LCMAP = LANGUAGE_ID + ".lcmap"; // Maps detected langcode to other valueString MAP_ENABLE = LANGUAGE_ID + ".map"; // Turns on or off the field mappingdiff --git a/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java b/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.javaindex f4f1b9cc83c..6ee384bbaee 100644--- a/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java+++ b/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java@@ -111,16 +111,8 @@ public abstract class LanguageIdentifierUpdateProcessor extends UpdateRequestProoverwrite = params.getBool(OVERWRITE, false);langAllowlist = new HashSet<>();threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);- final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();- if (!legacyAllowList.isEmpty()) {- // nowarn compile time string concatenation- log.warn(- LANG_WHITELIST- + " parameter is deprecated; use "- + LANG_ALLOWLIST- + " instead."); // nowarn- }- Arrays.stream(params.get(LANG_ALLOWLIST, legacyAllowList).split(","))++ Arrays.stream(params.get(LANG_ALLOWLIST, "").split(",")).map(String::trim).filter(lang -> !lang.isEmpty()).forEach(langAllowlist::add);diff --git a/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java b/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.javaindex 76581cc88e0..dc421084141 100644--- a/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java+++ b/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java@@ -474,19 +474,6 @@ public abstract class LanguageIdentifierUpdateProcessorFactoryTestCase extends SassertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);}- @Test- public void testAllowlistBackwardsCompatabilityWithLegacyAllowlist() throws Exception {- // The "legacy allowlist" is "langid.whitelist"- ModifiableSolrParams parameters = new ModifiableSolrParams();- parameters.add("langid.fl", "name,subject");- parameters.add("langid.langField", "language_s");- parameters.add("langid.whitelist", "no,en ,, ,sv, sv");- liProcessor = createLangIdProcessor(parameters);-- // Make sure that empty language codes have been filtered out and others trimmed.- assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);- }-// Various utility methodsprivate SolrInputDocument englishDoc() {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.javaindex 8849650c244..bf88ca3541f 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java@@ -331,20 +331,6 @@ public class CloudHttp2SolrClient extends CloudSolrClient {return this;}- /**- * When caches are expired then they are refreshed after acquiring a lock. Use this to set the- * number of locks.- *- * <p>Defaults to 3.- *- * @deprecated Please use {@link #withParallelCacheRefreshes(int)}- */- @Deprecated(since = "9.2")- public Builder setParallelCacheRefreshes(int parallelCacheRefreshesLocks) {- this.withParallelCacheRefreshes(parallelCacheRefreshesLocks);- return this;- }-/*** When caches are expired then they are refreshed after acquiring a lock. Use this to set the* number of locks.@@ -356,17 +342,6 @@ public class CloudHttp2SolrClient extends CloudSolrClient {return this;}- /**- * This is the time to wait to re-fetch the state after getting the same state version from ZK- *- * @deprecated Please use {@link #withRetryExpiryTime(long, TimeUnit)}- */- @Deprecated(since = "9.2")- public Builder setRetryExpiryTime(int secs) {- this.withRetryExpiryTime(secs, TimeUnit.SECONDS);- return this;- }-/*** This is the time to wait to re-fetch the state after getting the same state version from ZK*/@@ -381,18 +356,6 @@ public class CloudHttp2SolrClient extends CloudSolrClient {return this;}- /**- * Sets the cache ttl for DocCollection Objects cached.- *- * @param timeToLiveSeconds ttl value in seconds- * @deprecated Please use {@link #withCollectionCacheTtl(long, TimeUnit)}- */- @Deprecated(since = "9.2")- public Builder withCollectionCacheTtl(int timeToLiveSeconds) {- withCollectionCacheTtl(timeToLiveSeconds, TimeUnit.SECONDS);- return this;- }-/*** Sets the cache ttl for DocCollection Objects cached.*diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.javaindex 6cb95e9e3e5..7ab890b10be 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java@@ -1024,18 +1024,6 @@ public class Http2SolrClient extends HttpSolrClientBase {return this;}- /**- * Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited- * to 4- *- * @deprecated Please use {@link #withMaxConnectionsPerHost(int)}- */- @Deprecated(since = "9.2")- public Http2SolrClient.Builder maxConnectionsPerHost(int max) {- withMaxConnectionsPerHost(max);- return this;- }-/*** Set the scanning interval to check for updates in the Key Store used by this client. If the* interval is unset, 0 or less, then the Key Store Scanner is not created, and the client will@@ -1053,37 +1041,6 @@ public class Http2SolrClient extends HttpSolrClientBase {return this;}- /**- * @deprecated Please use {@link #withIdleTimeout(long, TimeUnit)}- */- @Deprecated(since = "9.2")- public Http2SolrClient.Builder idleTimeout(int idleConnectionTimeout) {- withIdleTimeout(idleConnectionTimeout, TimeUnit.MILLISECONDS);- return this;- }-- /**- * @deprecated Please use {@link #withConnectionTimeout(long, TimeUnit)}- */- @Deprecated(since = "9.2")- public Http2SolrClient.Builder connectionTimeout(int connectionTimeout) {- withConnectionTimeout(connectionTimeout, TimeUnit.MILLISECONDS);- return this;- }-- /**- * Set a timeout in milliseconds for requests issued by this client.- *- * @param requestTimeout The timeout in milliseconds- * @return this Builder.- * @deprecated Please use {@link #withRequestTimeout(long, TimeUnit)}- */- @Deprecated(since = "9.2")- public Http2SolrClient.Builder requestTimeout(int requestTimeout) {- withRequestTimeout(requestTimeout, TimeUnit.MILLISECONDS);- return this;- }-private HttpCookieStore getCookieStore() {if (cookieStore == null) {return cookieStore;diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.javaindex 55a4f8de0f5..73dbb45ce71 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClientBase.java@@ -115,13 +115,6 @@ public abstract class HttpSolrClientBase extends SolrClient {return requestWriter;}- // TODO: Remove this for 10.0, there is a typo in the method name- @Deprecated(since = "9.8", forRemoval = true)- protected ModifiableSolrParams initalizeSolrParams(- SolrRequest<?> solrRequest, ResponseParser parserToUse) {- return initializeSolrParams(solrRequest, parserToUse);- }-protected ModifiableSolrParams initializeSolrParams(SolrRequest<?> solrRequest, ResponseParser parserToUse) {// The parser 'wt=' param is used instead of the original paramsdiff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.javaindex 1844ad27a8b..1e44d700342 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java@@ -65,14 +65,6 @@ public class ZkNodeProps implements MapWriter {this(Utils.makeMap((Object[]) keyVals));}- /**- * @deprecated use {@link ZkNodeProps#ZkNodeProps(String...)}- */- @Deprecated(since = "9.0.0")- public static ZkNodeProps fromKeyVals(Object... keyVals) {- return new ZkNodeProps(Utils.makeMap(keyVals));- }-/** Get property keys. */public Set<String> keySet() {return propMap.keySet();