You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/26 18:21:27 UTC
[solr] 08/09: SOLR-16427: Evaluate and fix errorprone rules - LogicalAssignment
This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit 2e3894ab1fa6699bf7f11f3e029ecd37856bd636
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Mon Oct 24 17:41:35 2022 -0400
SOLR-16427: Evaluate and fix errorprone rules - LogicalAssignment
---
gradle/validation/error-prone.gradle | 1 -
.../java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java | 4 ++--
.../src/java/org/apache/solr/request/json/JsonQueryConverter.java | 4 ++--
.../src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java | 6 ++++--
.../src/java/org/apache/solr/cloud/AbstractMoveReplicaTestBase.java | 5 +++--
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 649d6921f4b..f5a30bf1483 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -95,7 +95,6 @@ allprojects { prj ->
'-Xep:IntLongMath:OFF',
'-Xep:InvalidBlockTag:OFF', // this is needed for tags like lucene.internal
'-Xep:JavaUtilDate:OFF',
- '-Xep:LogicalAssignment:OFF',
'-Xep:MissingSummary:OFF',
'-Xep:MixedMutabilityReturnType:OFF',
'-Xep:MutablePublicArray:OFF', // this should be possible...
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
index 5e31cc89b7c..0d8d1be61e6 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
@@ -75,8 +75,8 @@ public class OverseerRoleCmd implements CollApiCmds.CollectionApiCommand {
}
String roleName = message.getStr("role");
- boolean nodeExists = false;
- if (nodeExists = zkClient.exists(ZkStateReader.ROLES, true)) {
+ boolean nodeExists = zkClient.exists(ZkStateReader.ROLES, true);
+ if (nodeExists) {
@SuppressWarnings("unchecked")
Map<String, List<String>> tmp =
(Map<String, List<String>>)
diff --git a/solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java b/solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java
index 17f168fbec5..7c0baedd9d7 100644
--- a/solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java
+++ b/solr/core/src/java/org/apache/solr/request/json/JsonQueryConverter.java
@@ -114,8 +114,8 @@ class JsonQueryConverter {
}
} else {
if (qtype.equals("param")) {
- boolean toplevel;
- if (toplevel = (builder.length() == 0)) {
+ boolean toplevel = builder.length() == 0;
+ if (toplevel) {
builder.append("{!v=");
}
builder.append("$").append(map.get("param"));
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
index f8f117020c3..d088e0819a7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
@@ -629,7 +629,8 @@ public abstract class LBSolrClient extends SolrClient {
long timeAllowedNano = getTimeAllowedInNanos(request);
long timeOutTime = System.nanoTime() + timeAllowedNano;
for (int attempts = 0; attempts < maxTries; attempts++) {
- if (timeAllowedExceeded = isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ timeAllowedExceeded = isTimeExceeded(timeAllowedNano, timeOutTime);
+ if (timeAllowedExceeded) {
break;
}
@@ -657,7 +658,8 @@ public abstract class LBSolrClient extends SolrClient {
// try other standard servers that we didn't try just now
for (ServerWrapper wrapper : zombieServers.values()) {
- if (timeAllowedExceeded = isTimeExceeded(timeAllowedNano, timeOutTime)) {
+ timeAllowedExceeded = isTimeExceeded(timeAllowedNano, timeOutTime);
+ if (timeAllowedExceeded) {
break;
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractMoveReplicaTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractMoveReplicaTestBase.java
index 58a0b928150..676e4bc2e96 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractMoveReplicaTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractMoveReplicaTestBase.java
@@ -69,10 +69,11 @@ public abstract class AbstractMoveReplicaTestBase extends SolrCloudTestCase {
.configure();
// If Collection API is distributed let's not wait for Overseer.
- if (isCollectionApiDistributed =
+ isCollectionApiDistributed =
new CollectionAdminRequest.RequestApiDistributedProcessing()
.process(cluster.getSolrClient())
- .getIsCollectionApiDistributed()) {
+ .getIsCollectionApiDistributed();
+ if (isCollectionApiDistributed) {
return;
}