SOLR-14548 Address warning: static member should be qualified by type… (#1555)

This commit is contained in:
Mike Drob 2020-06-09 15:33:37 -05:00 committed by GitHub
parent 1ab9b811c6
commit 8ee6e6797b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 55 deletions

View File

@ -317,6 +317,8 @@ Other Changes
* SOLR-14545: Fix or suppress warnings in apache/solr/update (Erick Erickson)
* SOLR-14548: Address warning: static member should be qualified by type name (Mike Drob)
================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -172,20 +172,20 @@ public class JettySolrRunner {
private void executeDelay() {
int delayMs = 0;
for (Delay delay: delays) {
this.log.info("Delaying {}, for reason: {}", delay.delayValue, delay.reason);
log.info("Delaying {}, for reason: {}", delay.delayValue, delay.reason);
if (delay.counter.decrementAndGet() == 0) {
delayMs += delay.delayValue;
}
}
if (delayMs > 0) {
this.log.info("Pausing this socket connection for {}ms...", delayMs);
log.info("Pausing this socket connection for {}ms...", delayMs);
try {
Thread.sleep(delayMs);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
this.log.info("Waking up after the delay of {}ms...", delayMs);
log.info("Waking up after the delay of {}ms...", delayMs);
}
}

View File

@ -34,7 +34,6 @@ import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
@ -108,14 +107,13 @@ public class ZkCLI implements CLIO {
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption(OptionBuilder
options.addOption(Option.builder(CMD)
.hasArg(true)
.withDescription(
.desc(
"cmd to run: " + BOOTSTRAP + ", " + UPCONFIG + ", " + DOWNCONFIG
+ ", " + LINKCONFIG + ", " + MAKEPATH + ", " + PUT + ", " + PUT_FILE + ","
+ GET + "," + GET_FILE + ", " + LIST + ", " + CLEAR
+ ", " + UPDATEACLS + ", " + LS).create(CMD));
+ ", " + UPDATEACLS + ", " + LS).build());
Option zkHostOption = new Option("z", ZKHOST, true,
"ZooKeeper host address");

View File

@ -171,7 +171,7 @@ public class SolrRequestParsers {
ArrayList<ContentStream> streams = new ArrayList<>(1);
SolrParams params = parser.parseParamsAndFillStreams( req, streams );
if (GlobalTracer.get().tracing()) {
GlobalTracer.get().getTracer().activeSpan().setTag("params", params.toString());
GlobalTracer.getTracer().activeSpan().setTag("params", params.toString());
}
SolrQueryRequest sreq = buildRequestFrom(core, params, streams, getRequestTimer(req), req);

View File

@ -50,7 +50,6 @@ import java.util.zip.GZIPOutputStream;
import com.google.common.collect.ImmutableSet;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.lucene.util.SuppressForbidden;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest;
@ -214,36 +213,36 @@ public class ExportTool extends SolrCLI.ToolBase {
}
private static final Option[] OPTIONS = {
OptionBuilder
Option.builder("url")
.hasArg()
.isRequired(true)
.withDescription("Address of the collection, example http://localhost:8983/solr/gettingstarted")
.create("url"),
OptionBuilder
.required()
.desc("Address of the collection, example http://localhost:8983/solr/gettingstarted")
.build(),
Option.builder("out")
.hasArg()
.isRequired(false)
.withDescription("file name . defaults to collection-name.<format>")
.create("out"),
OptionBuilder
.required(false)
.desc("file name . defaults to collection-name.<format>")
.build(),
Option.builder("format")
.hasArg()
.isRequired(false)
.withDescription("format json/javabin, default to json. file extension would be .json")
.create("format"),
OptionBuilder
.required(false)
.desc("format json/javabin, default to json. file extension would be .json")
.build(),
Option.builder("limit")
.hasArg()
.isRequired(false)
.withDescription("Max number of docs to download. default = 100, use -1 for all docs")
.create("limit"),
OptionBuilder
.required(false)
.desc("Max number of docs to download. default = 100, use -1 for all docs")
.build(),
Option.builder("query")
.hasArg()
.isRequired(false)
.withDescription("A custom query, default is *:*")
.create("query"),
OptionBuilder
.required(false)
.desc("A custom query, default is *:*")
.build(),
Option.builder("fields")
.hasArg()
.isRequired(false)
.withDescription("Comma separated fields. By default all fields are fetched")
.create("fields")
.required(false)
.desc("Comma separated fields. By default all fields are fetched")
.build()
};
static class JsonSink extends DocsSink {

View File

@ -53,6 +53,7 @@ import org.apache.solr.schema.IndexSchemaFactory;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.search.DocIterator;
import org.apache.solr.search.DocList;
import org.apache.solr.util.BaseTestHarness;
import org.junit.BeforeClass;
import org.junit.Test;
@ -231,7 +232,7 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {
,"//*[@numFound='0']"
);
assertU(h.simpleTag("rollback"));
assertU(BaseTestHarness.simpleTag("rollback"));
assertU(commit());
}

View File

@ -105,7 +105,7 @@ public class TestSolrCloudSnapshots extends SolrCloudTestCase {
// Here the assumption is that Solr will spread the replicas uniformly across nodes.
// If this is not true for some reason, then we will need to add some logic to find a
// node with a single replica.
this.cluster.getRandomJetty(random()).stop();
cluster.getRandomJetty(random()).stop();
// Sleep a bit for allowing ZK watch to fire.
Thread.sleep(5000);

View File

@ -332,7 +332,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
List replicatedAtCount = (List) ((NamedList) details.get("slave")).get("indexReplicatedAtList");
int tries = 0;
while ((replicatedAtCount == null || replicatedAtCount.size() < i) && tries++ < 5) {
Thread.currentThread().sleep(1000);
Thread.sleep(1000);
details = getDetails(slaveClient);
replicatedAtCount = (List) ((NamedList) details.get("slave")).get("indexReplicatedAtList");
}

View File

@ -33,6 +33,7 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.stream.expr.Explanation;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.BaseTestHarness;
import org.junit.BeforeClass;
import org.junit.Test;
@ -59,7 +60,7 @@ public class TestGraphMLResponseWriter extends SolrTestCaseJ4 {
String graphML = writer.toString();
//Validate the nodes
String error = h.validateXPath(graphML,
String error = BaseTestHarness.validateXPath(graphML,
"//graph/node[1][@id ='bill']",
"//graph/node[2][@id ='jim']",
"//graph/node[3][@id ='max']");
@ -67,7 +68,7 @@ public class TestGraphMLResponseWriter extends SolrTestCaseJ4 {
throw new Exception(error);
}
//Validate the edges
error = h.validateXPath(graphML,
error = BaseTestHarness.validateXPath(graphML,
"//graph/edge[1][@source ='jim']",
"//graph/edge[1][@target ='bill']",
"//graph/edge[2][@source ='max']",

View File

@ -20,6 +20,7 @@ import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.util.BaseTestHarness;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -65,7 +66,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("partitionKeys", "a_i,a_s,a_i,a_s");
params.add("wt", "xml");
String response = h.query(req(params));
h.validateXPath(response, "//*[@numFound='0']");
BaseTestHarness.validateXPath(response, "//*[@numFound='0']");
params = new ModifiableSolrParams();
params.add("q", "*:*");
@ -103,7 +104,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("partitionKeys", "a_s");
params.add("wt", "xml");
String response = h.query(req(params));
h.validateXPath(response, "//*[@numFound='4']");
BaseTestHarness.validateXPath(response, "//*[@numFound='4']");
//Test with int hash
params = new ModifiableSolrParams();
@ -112,7 +113,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("partitionKeys", "a_i");
params.add("wt", "xml");
response = h.query(req(params));
h.validateXPath(response, "//*[@numFound='4']");
BaseTestHarness.validateXPath(response, "//*[@numFound='4']");
}
@ -153,7 +154,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set1.add(s);
}
@ -172,7 +173,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set2.add(s);
}
@ -192,7 +193,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set3.add(s);
}
@ -223,7 +224,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set1.add(s);
}
@ -242,7 +243,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set2.add(s);
}
@ -270,7 +271,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set1.add(s);
}
@ -289,7 +290,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
while(it.hasNext()) {
String s = it.next();
String results = h.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
String results = BaseTestHarness.validateXPath(response, "*[count(//str[@name='id'][.='"+s+"'])=1]");
if(results == null) {
set2.add(s);
}

View File

@ -96,7 +96,7 @@ class DebugAgg extends AggValueSource {
public Acc(FacetContext fcontext, long numDocs, int numSlots, SlotAcc sub) {
super(fcontext);
this.last = this;
last = this;
this.numDocs = numDocs;
this.numSlots = numSlots;
this.sub = sub;

View File

@ -90,7 +90,7 @@ public class JWTVerificationkeyResolverTest extends SolrTestCaseJ4 {
when(httpsJwksFactory.createList(anyList())).thenReturn(asList(firstJwkList, secondJwkList));
JWTIssuerConfig issuerConfig = new JWTIssuerConfig("primary").setIss("foo").setJwksUrl(asList("url1", "url2"));
issuerConfig.setHttpsJwksFactory(httpsJwksFactory);
JWTIssuerConfig.setHttpsJwksFactory(httpsJwksFactory);
resolver = new JWTVerificationkeyResolver(Arrays.asList(issuerConfig), true);
assumeWorkingMockito();

View File

@ -59,6 +59,7 @@ import org.apache.solr.cloud.AbstractDistribZkTestBase;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.util.BaseTestHarness;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -887,7 +888,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);
String xml = readString(reader);
//Validate the nodes
String error = h.validateXPath(xml,
String error = BaseTestHarness.validateXPath(xml,
"//graph/node[1][@id ='jim']",
"//graph/node[2][@id ='max']",
"//graph/node[3][@id ='sam']");
@ -895,7 +896,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
throw new Exception(error);
}
//Validate the edges
error = h.validateXPath(xml,
error = BaseTestHarness.validateXPath(xml,
"//graph/edge[1][@source ='bill']",
"//graph/edge[1][@target ='jim']",
"//graph/edge[2][@source ='bill']",

View File

@ -136,6 +136,7 @@ import org.apache.solr.servlet.DirectSolrConnection;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.apache.solr.update.processor.DistributedZkUpdateProcessor;
import org.apache.solr.update.processor.UpdateRequestProcessor;
import org.apache.solr.util.BaseTestHarness;
import org.apache.solr.util.ExternalPaths;
import org.apache.solr.util.LogLevel;
import org.apache.solr.util.RandomizeSSL;
@ -988,7 +989,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
tests = allTests;
}
String results = h.validateXPath(response, tests);
String results = BaseTestHarness.validateXPath(response, tests);
if (null != results) {
String msg = "REQUEST FAILED: xpath=" + results

View File

@ -1058,7 +1058,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
protected void waitForRecoveriesToFinish(boolean verbose, long timeoutSeconds)
throws Exception {
ZkStateReader zkStateReader = cloudClient.getZkStateReader();
super.waitForRecoveriesToFinish(DEFAULT_COLLECTION, zkStateReader, verbose, true, timeoutSeconds);
waitForRecoveriesToFinish(DEFAULT_COLLECTION, zkStateReader, verbose, true, timeoutSeconds);
}
protected void checkQueries() throws Exception {