Skip to content

Commit 8d28b3a

Browse files
authored
SOLR-17931: Remove deprecated code (#3696)
1 parent caf5f5e commit 8d28b3a

12 files changed

Lines changed: 13 additions & 161 deletions

File tree

solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.lang.invoke.MethodHandles;
2323
import java.nio.file.FileSystems;
2424
import java.nio.file.Path;
25-
import org.apache.solr.common.SolrException.ErrorCode;
26-
import org.apache.solr.common.cloud.ZooKeeperException;
2725
import org.apache.solr.common.util.Pair;
2826
import org.apache.solr.core.SolrResourceLoader;
2927
import org.apache.solr.core.SolrResourceNotFoundException;
@@ -155,13 +153,6 @@ public Stat getStat() {
155153
}
156154
}
157155

158-
@Override
159-
public String getConfigDir() {
160-
throw new ZooKeeperException(
161-
ErrorCode.SERVER_ERROR,
162-
"ZkSolrResourceLoader does not support getConfigDir() - likely, what you are trying to do is not supported in ZooKeeper mode");
163-
}
164-
165156
public String getConfigSetZkPath() {
166157
return configSetZkPath;
167158
}

solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,6 @@ public Path getConfigPath() {
324324
return instanceDir.resolve("conf");
325325
}
326326

327-
/**
328-
* @deprecated use {@link #getConfigPath()}
329-
*/
330-
@Deprecated(since = "9.0.0")
331-
public String getConfigDir() {
332-
return getConfigPath().toString();
333-
}
334-
335327
/**
336328
* EXPERT
337329
*

solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.UnsupportedEncodingException;
2121
import java.lang.invoke.MethodHandles;
2222
import java.net.URISyntaxException;
23+
import java.net.URL;
2324
import java.nio.file.Files;
2425
import java.nio.file.Path;
2526
import java.util.Date;
@@ -305,7 +306,6 @@ public static boolean isHiddenFile(
305306
String fname = fnameIn.toUpperCase(Locale.ROOT);
306307
if (hiddenFiles.contains(fname) || hiddenFiles.contains("*")) {
307308
if (reportError) {
308-
log.error("Cannot access {}", fname);
309309
rsp.setException(
310310
new SolrException(SolrException.ErrorCode.FORBIDDEN, "Can not access: " + fnameIn));
311311
}
@@ -316,7 +316,6 @@ public static boolean isHiddenFile(
316316
// the effort though to fix it to handle all possibilities though.
317317
if (fname.contains("..") || fname.startsWith(".")) {
318318
if (reportError) {
319-
log.error("Invalid path: {}", fname);
320319
rsp.setException(
321320
new SolrException(SolrException.ErrorCode.FORBIDDEN, "Invalid path: " + fnameIn));
322321
}
@@ -355,7 +354,6 @@ public static String getAdminFileFromZooKeeper(
355354

356355
// Make sure the file exists, is readable and is not a hidden file
357356
if (!zkClient.exists(adminFile, true)) {
358-
log.error("Can not find: {}", adminFile);
359357
rsp.setException(
360358
new SolrException(SolrException.ErrorCode.NOT_FOUND, "Can not find: " + adminFile));
361359
return null;
@@ -374,9 +372,17 @@ public static Path getAdminFileFromFileSystem(
374372
if (!Files.exists(configDir)) {
375373
// TODO: maybe we should just open it this way to start with?
376374
try {
377-
configDir = Path.of(loader.getClassLoader().getResource(loader.getConfigDir()).toURI());
375+
URL configUrl = loader.getClassLoader().getResource(loader.getConfigPath().toString());
376+
if (configUrl == null) {
377+
rsp.setException(
378+
new SolrException(
379+
SolrException.ErrorCode.FORBIDDEN,
380+
"Configuration directory resource not found: "
381+
+ loader.getConfigPath().toString()));
382+
return null;
383+
}
384+
configDir = Path.of(configUrl.toURI());
378385
} catch (URISyntaxException e) {
379-
log.error("Can not access configuration directory!");
380386
rsp.setException(
381387
new SolrException(
382388
SolrException.ErrorCode.FORBIDDEN, "Can not access configuration directory!", e));
@@ -390,7 +396,6 @@ public static Path getAdminFileFromFileSystem(
390396

391397
fname = fname.replace('\\', '/'); // normalize slashes
392398
if (hiddenFiles.contains(fname.toUpperCase(Locale.ROOT))) {
393-
log.error("Can not access: {}", fname);
394399
rsp.setException(
395400
new SolrException(SolrException.ErrorCode.FORBIDDEN, "Can not access: " + fname));
396401
return null;
@@ -399,7 +404,6 @@ public static Path getAdminFileFromFileSystem(
399404
Path filePath = configDir.resolve(fname.startsWith("/") ? fname.substring(1) : fname);
400405
req.getCoreContainer().assertPathAllowed(filePath);
401406
if (!filePath.normalize().startsWith(configDir.normalize())) {
402-
log.error("Path must be inside core config directory");
403407
rsp.setException(
404408
new SolrException(ErrorCode.BAD_REQUEST, "Path must be inside core config directory"));
405409
return null;

solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ public CPUCircuitBreaker() {
5050
super();
5151
}
5252

53-
@Deprecated(since = "9.5")
54-
public CPUCircuitBreaker(SolrCore core) {
55-
this(core.getCoreContainer());
56-
}
57-
5853
public CPUCircuitBreaker(CoreContainer coreContainer) {
5954
super();
6055
this.cc = coreContainer;

solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ public class JWTAuthPlugin extends AuthenticationPlugin
100100
private static final long DEFAULT_REFRESH_REPRIEVE_THRESHOLD = 5000;
101101
static final String PRIMARY_ISSUER = "PRIMARY";
102102

103-
@Deprecated(since = "9.0") // Remove in 10.0
104-
private static final String PARAM_ALG_WHITELIST = "algWhitelist";
105-
106103
private static final Set<String> PROPS =
107104
Set.of(
108105
PARAM_BLOCK_UNKNOWN,
@@ -186,14 +183,6 @@ public void init(Map<String, Object> pluginConfig) {
186183

187184
rolesClaim = (String) pluginConfig.get(PARAM_ROLES_CLAIM);
188185
algAllowlist = (List<String>) pluginConfig.get(PARAM_ALG_ALLOWLIST);
189-
// TODO: Remove deprecated warning in Solr 10.0
190-
if ((algAllowlist == null || algAllowlist.isEmpty())
191-
&& pluginConfig.containsKey(PARAM_ALG_WHITELIST)) {
192-
log.warn(
193-
"Found use of deprecated parameter algWhitelist. Please use {} instead.",
194-
PARAM_ALG_ALLOWLIST);
195-
algAllowlist = (List<String>) pluginConfig.get(PARAM_ALG_WHITELIST);
196-
}
197186
realm = (String) pluginConfig.getOrDefault(PARAM_REALM, DEFAULT_AUTH_REALM);
198187

199188
Map<String, String> claimsMatch = (Map<String, String>) pluginConfig.get(PARAM_CLAIMS_MATCH);

solr/modules/langid/src/java/org/apache/solr/update/processor/LangIdParams.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public interface LangIdParams {
3232
String ENFORCE_SCHEMA =
3333
LANGUAGE_ID + ".enforceSchema"; // Enforces that output fields exist in schema
3434

35-
@Deprecated(since = "9.0.0")
36-
String LANG_WHITELIST = LANGUAGE_ID + ".whitelist"; // Old property name for allowed languages
37-
3835
String LANG_ALLOWLIST = LANGUAGE_ID + ".allowlist"; // Allowed languages
3936
String LCMAP = LANGUAGE_ID + ".lcmap"; // Maps detected langcode to other value
4037
String MAP_ENABLE = LANGUAGE_ID + ".map"; // Turns on or off the field mapping

solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,8 @@ private void initParams(SolrParams params) {
111111
overwrite = params.getBool(OVERWRITE, false);
112112
langAllowlist = new HashSet<>();
113113
threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT);
114-
final String legacyAllowList = params.get(LANG_WHITELIST, "").trim();
115-
if (!legacyAllowList.isEmpty()) {
116-
// nowarn compile time string concatenation
117-
log.warn(
118-
LANG_WHITELIST
119-
+ " parameter is deprecated; use "
120-
+ LANG_ALLOWLIST
121-
+ " instead."); // nowarn
122-
}
123-
Arrays.stream(params.get(LANG_ALLOWLIST, legacyAllowList).split(","))
114+
115+
Arrays.stream(params.get(LANG_ALLOWLIST, "").split(","))
124116
.map(String::trim)
125117
.filter(lang -> !lang.isEmpty())
126118
.forEach(langAllowlist::add);

solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -474,19 +474,6 @@ public void testAllowlist() throws Exception {
474474
assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);
475475
}
476476

477-
@Test
478-
public void testAllowlistBackwardsCompatabilityWithLegacyAllowlist() throws Exception {
479-
// The "legacy allowlist" is "langid.whitelist"
480-
ModifiableSolrParams parameters = new ModifiableSolrParams();
481-
parameters.add("langid.fl", "name,subject");
482-
parameters.add("langid.langField", "language_s");
483-
parameters.add("langid.whitelist", "no,en ,, ,sv, sv");
484-
liProcessor = createLangIdProcessor(parameters);
485-
486-
// Make sure that empty language codes have been filtered out and others trimmed.
487-
assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist);
488-
}
489-
490477
// Various utility methods
491478

492479
private SolrInputDocument englishDoc() {

solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudHttp2SolrClient.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -331,20 +331,6 @@ public Builder withParallelUpdates(boolean parallelUpdates) {
331331
return this;
332332
}
333333

334-
/**
335-
* When caches are expired then they are refreshed after acquiring a lock. Use this to set the
336-
* number of locks.
337-
*
338-
* <p>Defaults to 3.
339-
*
340-
* @deprecated Please use {@link #withParallelCacheRefreshes(int)}
341-
*/
342-
@Deprecated(since = "9.2")
343-
public Builder setParallelCacheRefreshes(int parallelCacheRefreshesLocks) {
344-
this.withParallelCacheRefreshes(parallelCacheRefreshesLocks);
345-
return this;
346-
}
347-
348334
/**
349335
* When caches are expired then they are refreshed after acquiring a lock. Use this to set the
350336
* number of locks.
@@ -356,17 +342,6 @@ public Builder withParallelCacheRefreshes(int parallelCacheRefreshesLocks) {
356342
return this;
357343
}
358344

359-
/**
360-
* This is the time to wait to re-fetch the state after getting the same state version from ZK
361-
*
362-
* @deprecated Please use {@link #withRetryExpiryTime(long, TimeUnit)}
363-
*/
364-
@Deprecated(since = "9.2")
365-
public Builder setRetryExpiryTime(int secs) {
366-
this.withRetryExpiryTime(secs, TimeUnit.SECONDS);
367-
return this;
368-
}
369-
370345
/**
371346
* This is the time to wait to re-fetch the state after getting the same state version from ZK
372347
*/
@@ -381,18 +356,6 @@ public Builder withDefaultCollection(String defaultCollection) {
381356
return this;
382357
}
383358

384-
/**
385-
* Sets the cache ttl for DocCollection Objects cached.
386-
*
387-
* @param timeToLiveSeconds ttl value in seconds
388-
* @deprecated Please use {@link #withCollectionCacheTtl(long, TimeUnit)}
389-
*/
390-
@Deprecated(since = "9.2")
391-
public Builder withCollectionCacheTtl(int timeToLiveSeconds) {
392-
withCollectionCacheTtl(timeToLiveSeconds, TimeUnit.SECONDS);
393-
return this;
394-
}
395-
396359
/**
397360
* Sets the cache ttl for DocCollection Objects cached.
398361
*

solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,18 +1024,6 @@ public HttpSolrClientBuilderBase<Http2SolrClient.Builder, Http2SolrClient> withS
10241024
return this;
10251025
}
10261026

1027-
/**
1028-
* Set maxConnectionsPerHost for http1 connections, maximum number http2 connections is limited
1029-
* to 4
1030-
*
1031-
* @deprecated Please use {@link #withMaxConnectionsPerHost(int)}
1032-
*/
1033-
@Deprecated(since = "9.2")
1034-
public Http2SolrClient.Builder maxConnectionsPerHost(int max) {
1035-
withMaxConnectionsPerHost(max);
1036-
return this;
1037-
}
1038-
10391027
/**
10401028
* Set the scanning interval to check for updates in the Key Store used by this client. If the
10411029
* interval is unset, 0 or less, then the Key Store Scanner is not created, and the client will
@@ -1053,37 +1041,6 @@ public Http2SolrClient.Builder withKeyStoreReloadInterval(long interval, TimeUni
10531041
return this;
10541042
}
10551043

1056-
/**
1057-
* @deprecated Please use {@link #withIdleTimeout(long, TimeUnit)}
1058-
*/
1059-
@Deprecated(since = "9.2")
1060-
public Http2SolrClient.Builder idleTimeout(int idleConnectionTimeout) {
1061-
withIdleTimeout(idleConnectionTimeout, TimeUnit.MILLISECONDS);
1062-
return this;
1063-
}
1064-
1065-
/**
1066-
* @deprecated Please use {@link #withConnectionTimeout(long, TimeUnit)}
1067-
*/
1068-
@Deprecated(since = "9.2")
1069-
public Http2SolrClient.Builder connectionTimeout(int connectionTimeout) {
1070-
withConnectionTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
1071-
return this;
1072-
}
1073-
1074-
/**
1075-
* Set a timeout in milliseconds for requests issued by this client.
1076-
*
1077-
* @param requestTimeout The timeout in milliseconds
1078-
* @return this Builder.
1079-
* @deprecated Please use {@link #withRequestTimeout(long, TimeUnit)}
1080-
*/
1081-
@Deprecated(since = "9.2")
1082-
public Http2SolrClient.Builder requestTimeout(int requestTimeout) {
1083-
withRequestTimeout(requestTimeout, TimeUnit.MILLISECONDS);
1084-
return this;
1085-
}
1086-
10871044
private HttpCookieStore getCookieStore() {
10881045
if (cookieStore == null) {
10891046
return cookieStore;

0 commit comments

Comments
 (0)