Apache Solr open-source search software
SOLR-16427: Evaluate and fix errorprone rules - InconsistentCapitalization
Kevin Risden0312473bc804
diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradleindex 6c505aea73a..e5cf063dc8a 100644--- a/gradle/validation/error-prone.gradle+++ b/gradle/validation/error-prone.gradle@@ -81,7 +81,6 @@ allprojects { prj ->'-Xep:Finally:OFF','-Xep:FutureReturnValueIgnored:OFF','-Xep:IdentityBinaryExpression:OFF',- '-Xep:InconsistentCapitalization:OFF','-Xep:InlineFormatString:OFF', // this introduces redundancy in format strings'-Xep:InlineMeSuggester:OFF', // We don't use this annotation'-Xep:InputStreamSlowMultibyteRead:OFF',@@ -106,7 +105,7 @@ allprojects { prj ->'-Xep:ThreadPriorityCheck:OFF','-Xep:TypeParameterShadowing:OFF','-Xep:TypeParameterUnusedInFormals:OFF',- '-Xep:UnicodeEscape:OFF',+ '-Xep:UnicodeEscape:OFF', // can't enable since Lucene/Solr tests use unicode a bunch'-Xep:UnnecessaryParentheses:OFF','-Xep:UnusedMethod:OFF','-Xep:UnusedVariable:OFF',diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSet.java b/solr/core/src/java/org/apache/solr/core/ConfigSet.javaindex e3d9de4ea86..857fbb30552 100644--- a/solr/core/src/java/org/apache/solr/core/ConfigSet.java+++ b/solr/core/src/java/org/apache/solr/core/ConfigSet.java@@ -28,7 +28,7 @@ public class ConfigSet {private final String name;- private final SolrConfig solrconfig;+ private final SolrConfig solrConfig;private volatile IndexSchema schema;private final SchemaSupplier schemaSupplier;@@ -44,7 +44,7 @@ public class ConfigSet {NamedList<?> properties,boolean trusted) {this.name = name;- this.solrconfig = solrConfig;+ this.solrConfig = solrConfig;this.schemaSupplier = indexSchemaSupplier;schema = schemaSupplier.get(true);this.properties = properties;@@ -56,7 +56,7 @@ public class ConfigSet {}public SolrConfig getSolrConfig() {- return solrconfig;+ return solrConfig;}/**diff --git a/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java b/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.javaindex ef63850ac6b..5b872857bfc 100644--- a/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java+++ b/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java@@ -72,16 +72,16 @@ public class DistribPackageStore implements PackageStore {private final CoreContainer coreContainer;private Map<String, FileInfo> tmpFiles = new ConcurrentHashMap<>();- private final Path solrhome;+ private final Path solrHome;public DistribPackageStore(CoreContainer coreContainer) {this.coreContainer = coreContainer;- this.solrhome = Paths.get(this.coreContainer.getSolrHome());+ this.solrHome = Paths.get(this.coreContainer.getSolrHome());}@Overridepublic Path getRealpath(String path) {- return _getRealPath(path, solrhome);+ return _getRealPath(path, solrHome);}private static Path _getRealPath(String path, Path solrHome) {@@ -127,7 +127,7 @@ public class DistribPackageStore implements PackageStore {synchronized (DistribPackageStore.this) {this.metaData = meta;this.fileData = data;- _persistToFile(solrhome, path, data, meta);+ _persistToFile(solrHome, path, data, meta);if (log.isInfoEnabled()) {log.info("persisted a file {} and metadata. sizes {} {}", path, data.limit(), meta.limit());@@ -627,13 +627,13 @@ public class DistribPackageStore implements PackageStore {@Overridepublic Map<String, byte[]> getKeys() throws IOException {- return _getKeys(solrhome);+ return _getKeys(solrHome);}// reads local keys file- private static Map<String, byte[]> _getKeys(Path solrhome) throws IOException {+ private static Map<String, byte[]> _getKeys(Path solrHome) throws IOException {Map<String, byte[]> result = new HashMap<>();- Path keysDir = _getRealPath(PackageStoreAPI.KEYS_DIR, solrhome);+ Path keysDir = _getRealPath(PackageStoreAPI.KEYS_DIR, solrHome);File[] keyFiles = keysDir.toFile().listFiles();if (keyFiles == null) return result;diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.javaindex fa24e94968b..7cae4115598 100644--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java@@ -1629,9 +1629,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw}// Throw exception on directory traversal attempts- protected String validateFilenameOrError(String filename) {- if (filename != null) {- Path filePath = Paths.get(filename);+ protected String validateFilenameOrError(String fileName) {+ if (fileName != null) {+ Path filePath = Paths.get(fileName);filePath.forEach(subpath -> {if ("..".equals(subpath.toString())) {@@ -1641,7 +1641,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAwif (filePath.isAbsolute()) {throw new SolrException(ErrorCode.FORBIDDEN, "File name must be relative");}- return filename;+ return fileName;} else return null;}diff --git a/solr/core/src/java/org/apache/solr/schema/SchemaManager.java b/solr/core/src/java/org/apache/solr/schema/SchemaManager.javaindex 5ab9c412f1a..1d8482cdcea 100644--- a/solr/core/src/java/org/apache/solr/schema/SchemaManager.java+++ b/solr/core/src/java/org/apache/solr/schema/SchemaManager.java@@ -62,17 +62,21 @@ public class SchemaManager {final SolrQueryRequest req;ManagedIndexSchema managedIndexSchema;- int timeout;+ int updateTimeOut;public SchemaManager(SolrQueryRequest req) {this.req = req;+// The default timeout is 10 minutes when no BaseSolrResource.UPDATE_TIMEOUT_SECS is specified- timeout = req.getParams().getInt(BaseSolrResource.UPDATE_TIMEOUT_SECS, 600);+ int defaultUpdateTimeOut = 600;++ updateTimeOut =+ req.getParams().getInt(BaseSolrResource.UPDATE_TIMEOUT_SECS, defaultUpdateTimeOut);// If BaseSolrResource.UPDATE_TIMEOUT_SECS=0 or -1 then end time then we'll try for 10 mins (// default timeout )- if (timeout < 1) {- timeout = 600;+ if (updateTimeOut < 1) {+ updateTimeOut = defaultUpdateTimeOut;}}@@ -97,7 +101,7 @@ public class SchemaManager {private List<Map<String, Object>> doOperations(List<CommandOperation> operations)throws InterruptedException, IOException, KeeperException {- TimeOut timeOut = new TimeOut(timeout, TimeUnit.SECONDS, TimeSource.NANO_TIME);+ TimeOut timeOut = new TimeOut(updateTimeOut, TimeUnit.SECONDS, TimeSource.NANO_TIME);SolrCore core = req.getCore();String errorMsg = "Unable to persist managed schema. ";List<Map<String, Object>> errors = Collections.emptyList();diff --git a/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java b/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.javaindex cc3f4d91216..b7628fde606 100644--- a/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java+++ b/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java@@ -73,13 +73,13 @@ public class FileFloatSource extends ValueSource {* @param field the source's SchemaField* @param keyField the field to use as a key* @param defVal the default value to use if a field has no entry in the external file- * @param datadir the directory in which to look for the external file+ * @param dataDir the directory in which to look for the external file*/- public FileFloatSource(SchemaField field, SchemaField keyField, float defVal, String datadir) {+ public FileFloatSource(SchemaField field, SchemaField keyField, float defVal, String dataDir) {this.field = field;this.keyField = keyField;this.defVal = defVal;- this.dataDir = datadir;+ this.dataDir = dataDir;}@Overridediff --git a/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java b/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.javaindex 7f899eccaf8..99224d881f6 100644--- a/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java+++ b/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java@@ -119,7 +119,7 @@ public class CommandHandler {private final QueryCommand queryCommand;private final List<Command<?>> commands;private final SolrIndexSearcher searcher;- private final boolean needDocset;+ private final boolean needDocSet;private final boolean truncateGroups;private final boolean includeHitCount;private boolean partialResults = false;@@ -131,13 +131,13 @@ public class CommandHandler {QueryCommand queryCommand,List<Command<?>> commands,SolrIndexSearcher searcher,- boolean needDocset,+ boolean needDocSet,boolean truncateGroups,boolean includeHitCount) {this.queryCommand = queryCommand;this.commands = commands;this.searcher = searcher;- this.needDocset = needDocset;+ this.needDocSet = needDocSet;this.truncateGroups = truncateGroups;this.includeHitCount = includeHitCount;}@@ -155,7 +155,7 @@ public class CommandHandler {if (truncateGroups) {docSet = computeGroupedDocSet(query, filter, collectors);- } else if (needDocset) {+ } else if (needDocSet) {docSet = computeDocSet(query, filter, collectors);} else if (!collectors.isEmpty()) {searchWithTimeLimiter(diff --git a/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java b/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.javaindex 2bee753a3ea..8b3aef7130c 100644--- a/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java+++ b/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java@@ -113,7 +113,7 @@ public class ConcurrentLRUCache<K, V> implements Cache<K, V>, Accountable {public ConcurrentLRUCache(int upperWaterMark,final int lowerWaterMark,- int acceptableWatermark,+ int acceptableWaterMark,int initialSize,boolean runCleanupThread,boolean runNewThreadForCleanup,@@ -121,7 +121,7 @@ public class ConcurrentLRUCache<K, V> implements Cache<K, V>, Accountable {this(upperWaterMark,lowerWaterMark,- acceptableWatermark,+ acceptableWaterMark,initialSize,runCleanupThread,runNewThreadForCleanup,@@ -132,7 +132,7 @@ public class ConcurrentLRUCache<K, V> implements Cache<K, V>, Accountable {public ConcurrentLRUCache(int upperWaterMark,final int lowerWaterMark,- int acceptableWatermark,+ int acceptableWaterMark,int initialSize,boolean runCleanupThread,boolean runNewThreadForCleanup,@@ -145,7 +145,7 @@ public class ConcurrentLRUCache<K, V> implements Cache<K, V>, Accountable {newThreadForCleanup = runNewThreadForCleanup;this.upperWaterMark = upperWaterMark;this.lowerWaterMark = lowerWaterMark;- this.acceptableWaterMark = acceptableWatermark;+ this.acceptableWaterMark = acceptableWaterMark;this.evictionListener = evictionListener;this.ramLowerWatermark = Long.MIN_VALUE;this.ramUpperWatermark = Long.MAX_VALUE;@@ -153,11 +153,11 @@ public class ConcurrentLRUCache<K, V> implements Cache<K, V>, Accountable {setRunCleanupThread(runCleanupThread);}- public ConcurrentLRUCache(int size, int lowerWatermark) {+ public ConcurrentLRUCache(int size, int lowerWaterMark) {this(size,- lowerWatermark,- (int) Math.floor((lowerWatermark + size) / 2.0),+ lowerWaterMark,+ (int) Math.floor((lowerWaterMark + size) / 2.0),(int) Math.ceil(0.75 * size),false,false,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 ea4b4d41acb..a6e528cfc95 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@@ -1030,8 +1030,8 @@ public class Http2SolrClient extends SolrClient {return this;}- public Builder connectionTimeout(int connectionTimeOut) {- this.connectionTimeout = connectionTimeOut;+ public Builder connectionTimeout(int connectionTimeout) {+ this.connectionTimeout = connectionTimeout;return this;}diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.javaindex ee2e5da51c7..8d75b9b6852 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java@@ -813,8 +813,8 @@ public class HttpSolrClient extends BaseHttpSolrClient {* In this case the client is more flexible and can be used to send requests to any cores. The* cost of this is that the core must be specified on each request.*/- public void setBaseURL(String baseURL) {- this.baseUrl = baseURL;+ public void setBaseURL(String baseUrl) {+ this.baseUrl = baseUrl;}public ResponseParser getParser() {diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.javaindex 4a29e3fbb6d..54da785fa3f 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Tuple.java@@ -359,12 +359,12 @@ public class Tuple implements Cloneable, MapWriter {* Create a new empty tuple marked as EXCEPTION, and optionally EOF.** @param msg exception message- * @param eof if true the tuple will be marked as EOF+ * @param isEOF if true the tuple will be marked as EOF*/- public static Tuple EXCEPTION(String msg, boolean eof) {+ public static Tuple EXCEPTION(String msg, boolean isEOF) {Tuple tuple = new Tuple();tuple.put(StreamParams.EXCEPTION, msg);- if (eof) {+ if (isEOF) {tuple.put(StreamParams.EOF, true);}return tuple;@@ -374,11 +374,11 @@ public class Tuple implements Cloneable, MapWriter {* Create a new empty tuple marked as EXCEPTION and optionally EOF.** @param t exception - full stack trace will be used as an exception message- * @param eof if true the tuple will be marked as EOF+ * @param isEOF if true the tuple will be marked as EOF*/- public static Tuple EXCEPTION(Throwable t, boolean eof) {+ public static Tuple EXCEPTION(Throwable t, boolean isEOF) {StringWriter sw = new StringWriter();t.printStackTrace(new PrintWriter(sw));- return EXCEPTION(sw.toString(), eof);+ return EXCEPTION(sw.toString(), isEOF);}}diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.javaindex 4d842681159..b3e6b609c80 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java@@ -204,9 +204,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {protected static volatile ExecutorService testExecutor;- protected void writeCoreProperties(Path coreDirectory, String corename) throws IOException {+ protected void writeCoreProperties(Path coreDirectory, String coreName) throws IOException {Properties props = new Properties();- props.setProperty("name", corename);+ props.setProperty("name", coreName);props.setProperty("configSet", "collection1");props.setProperty("config", "${solrconfig:solrconfig.xml}");props.setProperty("schema", "${schema:schema.xml}");diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.javaindex 9de548c2ec3..172e3258f1d 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java@@ -1026,7 +1026,7 @@ public class MiniSolrCloudCluster {private final int nodeCount;private final Path baseDir;- private String solrxml = DEFAULT_CLOUD_SOLR_XML;+ private String solrXml = DEFAULT_CLOUD_SOLR_XML;private JettyConfig.Builder jettyConfigBuilder;private Optional<String> securityJson = Optional.empty();@@ -1063,14 +1063,14 @@ public class MiniSolrCloudCluster {/** Use the provided string as solr.xml content */public Builder withSolrXml(String solrXml) {- this.solrxml = solrXml;+ this.solrXml = solrXml;return this;}/** Read solr.xml from the provided path */public Builder withSolrXml(Path solrXml) {try {- this.solrxml = new String(Files.readAllBytes(solrXml), Charset.defaultCharset());+ this.solrXml = new String(Files.readAllBytes(solrXml), Charset.defaultCharset());} catch (IOException e) {throw new RuntimeException(e);}@@ -1235,7 +1235,7 @@ public class MiniSolrCloudCluster {new MiniSolrCloudCluster(nodeCount,baseDir,- solrxml,+ solrXml,jettyConfig,null,securityJson,diff --git a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.javaindex 2f47fbcefe3..5242e9151ad 100644--- a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java+++ b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java@@ -75,11 +75,11 @@ public class SSLTestConfig {* <p>As needed, keystore/truststore information will be pulled from a hardcoded resource file* provided by the solr test-framework*- * @param useSSL - whether SSL should be required.+ * @param useSsl - whether SSL should be required.* @param clientAuth - whether client authentication should be required.*/- public SSLTestConfig(boolean useSSL, boolean clientAuth) {- this(useSSL, clientAuth, false);+ public SSLTestConfig(boolean useSsl, boolean clientAuth) {+ this(useSsl, clientAuth, false);}// NOTE: if any javadocs below change, update create-keystores.sh@@ -97,18 +97,18 @@ public class SSLTestConfig {* SSLTestConfig should care what CN/SAN are.* </ul>*- * @param useSSL - whether SSL should be required.+ * @param useSsl - whether SSL should be required.* @param clientAuth - whether client authentication should be required.* @param checkPeerName - whether the client should validate the 'peer name' of the SSL* Certificate (and which testing Cert should be used)* @see HttpClientUtil#SYS_PROP_CHECK_PEER_NAME*/- public SSLTestConfig(boolean useSSL, boolean clientAuth, boolean checkPeerName) {- this.useSsl = useSSL;+ public SSLTestConfig(boolean useSsl, boolean clientAuth, boolean checkPeerName) {+ this.useSsl = useSsl;this.clientAuth = clientAuth;this.checkPeerName = checkPeerName;- if (useSsl) {+ if (this.useSsl) {assumeSslIsSafeToTest();}