Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15583 Update error-prone to 2.8.1 and fix bug patterns (#260)

Mike Drobe21d3ed16da2
diff --git a/build.gradle b/build.gradle
index dc99edfe432..057d6a27ddb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -24,7 +24,7 @@ plugins {
id "org.owasp.dependencycheck" version "5.3.0"
id 'de.thetaphi.forbiddenapis' version '3.1' apply false
id "de.undercouch.download" version "4.0.2" apply false
- id "net.ltgt.errorprone" version "1.2.1" apply false
+ id "net.ltgt.errorprone" version "2.0.2" apply false
id 'com.diffplug.spotless' version "5.8.2" apply false
}
diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 3ed0bf31847..6302784b44a 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -49,6 +49,8 @@ allprojects { prj ->
tasks.withType(JavaCompile) { task ->
options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.errorproneArgs = [
+ '-Xep:InlineMeSuggester:OFF', // We don't use this annotation
+
// test
'-Xep:ExtendingJUnitAssert:OFF',
'-Xep:UseCorrectAssertInTests:OFF',
@@ -67,105 +69,86 @@ allprojects { prj ->
'-Xep:SelfAssignment:OFF',
'-Xep:InvalidPatternSyntax:OFF',
'-Xep:MissingFail:OFF',
- '-Xep:LossyPrimitiveCompare:OFF',
'-Xep:ComparableType:OFF',
'-Xep:InfiniteRecursion:OFF',
'-Xep:MisusedDayOfYear:OFF',
- '-Xep:FloatingPointAssertionWithinEpsilon:OFF',
- '-Xep:ThrowNull:OFF',
- '-Xep:StaticGuardedByInstance:OFF',
- '-Xep:ArrayHashCode:OFF',
+ '-Xep:AlmostJavadoc:OFF',
+ '-Xep:AmbiguousMethodReference:OFF',
+ '-Xep:ArgumentSelectionDefectChecker:OFF',
'-Xep:ArrayEquals:OFF',
- '-Xep:IdentityBinaryExpression:OFF',
- '-Xep:ComplexBooleanConstant:OFF',
- '-Xep:ComplexBooleanConstant:OFF',
- '-Xep:StreamResourceLeak:OFF',
- '-Xep:UnnecessaryLambda:OFF',
- '-Xep:ObjectToString:OFF',
- '-Xep:URLEqualsHashCode:OFF',
- '-Xep:DoubleBraceInitialization:OFF',
- '-Xep:ShortCircuitBoolean:OFF',
- '-Xep:InputStreamSlowMultibyteRead:OFF',
- '-Xep:NonCanonicalType:OFF',
- '-Xep:CollectionIncompatibleType:OFF',
- '-Xep:TypeParameterShadowing:OFF',
- '-Xep:ThreadJoinLoop:OFF',
- '-Xep:MutableConstantField:OFF',
- '-Xep:ReturnValueIgnored:OFF',
- '-Xep:CollectionIncompatibleType:OFF',
- '-Xep:SameNameButDifferent:OFF',
- '-Xep:InvalidParam:OFF',
- '-Xep:CompareToZero:OFF',
- '-Xep:DoubleCheckedLocking:OFF',
+ '-Xep:ArrayHashCode:OFF',
+ '-Xep:ArrayToString:OFF',
+ '-Xep:BadImport:OFF',
+ '-Xep:BadInstanceof:OFF',
'-Xep:BadShiftAmount:OFF',
+ '-Xep:ClassCanBeStatic:OFF',
+ '-Xep:CollectionIncompatibleType:OFF',
'-Xep:CollectionUndefinedEquality:OFF',
- '-Xep:UnescapedEntity:OFF',
- '-Xep:BoxedPrimitiveEquality:OFF',
- '-Xep:LogicalAssignment:OFF',
+ '-Xep:ComplexBooleanConstant:OFF',
+ '-Xep:DoubleBraceInitialization:OFF',
'-Xep:DoubleCheckedLocking:OFF',
- '-Xep:AmbiguousMethodReference:OFF',
- '-Xep:FormatString:OFF',
- '-Xep:InstanceOfAndCastMatchWrongType:OFF',
- '-Xep:ModifyCollectionInEnhancedForLoop:OFF',
- '-Xep:JavaLangClash:OFF',
- '-Xep:TypeParameterUnusedInFormals:OFF',
- '-Xep:UnusedNestedClass:OFF',
- '-Xep:OverrideThrowableToString:OFF',
- '-Xep:FutureReturnValueIgnored:OFF',
- '-Xep:BadInstanceof:OFF',
- '-Xep:UnusedNestedClass:OFF',
- '-Xep:OverrideThrowableToString:OFF',
+ '-Xep:EmptyCatch:OFF',
+ '-Xep:EqualsGetClass:OFF',
'-Xep:EqualsIncompatibleType:OFF',
- '-Xep:ByteBufferBackingArray:OFF',
- '-Xep:ByteBufferBackingArray:OFF',
- '-Xep:UnusedMethod:OFF',
- '-Xep:ObjectsHashCodePrimitive:OFF',
- '-Xep:ObjectsHashCodePrimitive:OFF',
- '-Xep:UnnecessaryAnonymousClass:OFF',
- '-Xep:BoxedPrimitiveConstructor:OFF',
- '-Xep:ArgumentSelectionDefectChecker:OFF',
- '-Xep:StringSplitter:OFF',
- '-Xep:MixedMutabilityReturnType:OFF',
'-Xep:EqualsUnsafeCast:OFF',
- '-Xep:OperatorPrecedence:OFF',
+ '-Xep:EscapedEntity:OFF',
+ '-Xep:Finally:OFF',
+ '-Xep:FormatString:OFF',
+ '-Xep:FutureReturnValueIgnored:OFF',
'-Xep:HidingField:OFF',
- '-Xep:ThreadPriorityCheck:OFF',
+ '-Xep:IdentityBinaryExpression:OFF',
+ '-Xep:IdentityHashMapUsage:OFF',
+ '-Xep:ImmutableEnumChecker:OFF',
+ '-Xep:InconsistentCapitalization:OFF',
+ '-Xep:InconsistentHashCode:OFF',
'-Xep:InlineFormatString:OFF',
- '-Xep:EqualsUnsafeCast:OFF',
- '-Xep:UnsynchronizedOverridesSynchronized:OFF',
- '-Xep:OperatorPrecedence:OFF',
- '-Xep:ArrayToString:OFF',
- '-Xep:ClassCanBeStatic:OFF',
+ '-Xep:InputStreamSlowMultibyteRead:OFF',
+ '-Xep:IntLongMath:OFF',
+ '-Xep:InvalidBlockTag:OFF',
'-Xep:InvalidInlineTag:OFF',
- '-Xep:EmptyCatch:OFF',
- '-Xep:UnnecessaryParentheses:OFF',
- '-Xep:AlmostJavadoc:OFF',
- '-Xep:Finally:OFF',
- '-Xep:ImmutableEnumChecker:OFF',
- '-Xep:NonAtomicVolatileUpdate:OFF',
- '-Xep:MutablePublicArray:OFF',
- '-Xep:LockNotBeforeTry:OFF',
- '-Xep:WaitNotInLoop:OFF',
- '-Xep:UndefinedEquals:OFF',
+ '-Xep:InvalidParam:OFF',
+ '-Xep:JavaLangClash:OFF',
+ '-Xep:JavaUtilDate:OFF',
'-Xep:JdkObsolete:OFF',
+ '-Xep:LockNotBeforeTry:OFF',
+ '-Xep:LogicalAssignment:OFF',
+ '-Xep:MissingOverride:OFF',
+ '-Xep:MissingSummary:OFF',
+ '-Xep:MixedMutabilityReturnType:OFF',
+ '-Xep:ModifiedButNotUsed:OFF',
+ '-Xep:MutableConstantField:OFF',
+ '-Xep:MutablePublicArray:OFF',
'-Xep:NarrowingCompoundAssignment:OFF',
- '-Xep:InconsistentCapitalization:OFF',
- '-Xep:IntLongMath:OFF',
- '-Xep:SynchronizeOnNonFinalField:OFF',
- '-Xep:ThreadLocalUsage:OFF',
+ '-Xep:NonAtomicVolatileUpdate:OFF',
+ '-Xep:NonCanonicalType:OFF',
+ '-Xep:ObjectToString:OFF',
+ '-Xep:ObjectsHashCodePrimitive:OFF',
+ '-Xep:OperatorPrecedence:OFF',
'-Xep:ProtectedMembersInFinalClass:OFF',
- '-Xep:BadImport:OFF',
- '-Xep:InconsistentHashCode:OFF',
- '-Xep:MissingOverride:OFF',
- '-Xep:EqualsGetClass:OFF',
'-Xep:PublicConstructorForAbstractClass:OFF',
- '-Xep:EscapedEntity:OFF',
- '-Xep:ModifiedButNotUsed:OFF',
'-Xep:ReferenceEquality:OFF',
- '-Xep:InvalidBlockTag:OFF',
- '-Xep:MissingSummary:OFF',
- '-Xep:UnusedVariable:OFF'
+ '-Xep:ReturnValueIgnored:OFF',
+ '-Xep:SameNameButDifferent:OFF',
+ '-Xep:ShortCircuitBoolean:OFF',
+ '-Xep:StaticGuardedByInstance:OFF',
+ '-Xep:StreamResourceLeak:OFF',
+ '-Xep:StringSplitter:OFF',
+ '-Xep:SynchronizeOnNonFinalField:OFF',
+ '-Xep:ThreadJoinLoop:OFF',
+ '-Xep:ThreadLocalUsage:OFF',
+ '-Xep:ThreadPriorityCheck:OFF',
+ '-Xep:TypeParameterShadowing:OFF',
+ '-Xep:TypeParameterUnusedInFormals:OFF',
+ '-Xep:URLEqualsHashCode:OFF',
+ '-Xep:UndefinedEquals:OFF',
+ '-Xep:UnescapedEntity:OFF',
+ '-Xep:UnnecessaryParentheses:OFF',
+ '-Xep:UnsynchronizedOverridesSynchronized:OFF',
+ '-Xep:UnusedMethod:OFF',
+ '-Xep:UnusedNestedClass:OFF',
+ '-Xep:UnusedVariable:OFF',
+ '-Xep:WaitNotInLoop:OFF',
]
}
}
diff --git a/solr/contrib/analytics/src/test/org/apache/solr/analytics/value/ConstantValueTest.java b/solr/contrib/analytics/src/test/org/apache/solr/analytics/value/ConstantValueTest.java
index c7e6a346e01..ba1f65b2310 100644
--- a/solr/contrib/analytics/src/test/org/apache/solr/analytics/value/ConstantValueTest.java
+++ b/solr/contrib/analytics/src/test/org/apache/solr/analytics/value/ConstantValueTest.java
@@ -52,7 +52,7 @@ public class ConstantValueTest extends SolrTestCaseJ4 {
// Double
uncasted = ConstantValue.creatorFunction.apply("12341234.12341234");
assertTrue(uncasted instanceof ConstantDoubleValue);
- assertEquals(12341234.12341234, ((ConstantDoubleValue)uncasted).getDouble(), .000000001);
+ assertEquals(12341234.12341234, ((ConstantDoubleValue)uncasted).getDouble(), 0);
// String
uncasted = ConstantValue.creatorFunction.apply("'abcdef'");
diff --git a/solr/core/src/java/org/apache/solr/api/ApiBag.java b/solr/core/src/java/org/apache/solr/api/ApiBag.java
index 8c8272b0bad..0e495bd5598 100644
--- a/solr/core/src/java/org/apache/solr/api/ApiBag.java
+++ b/solr/core/src/java/org/apache/solr/api/ApiBag.java
@@ -431,8 +431,9 @@ public class ApiBag {
return errs;
}
- public String toString() {
- return super.toString() + ", errors: " + getErrs() + ", ";
+ @Override
+ public String getMessage() {
+ return super.getMessage() + ", errors: " + getErrs() + ", ";
}
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java b/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
index a54eac91473..0821fde2f49 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/NodeMutator.java
@@ -101,7 +101,7 @@ public class NodeMutator {
}
Slice newSlice = new Slice(slice.getName(), newReplicas, slice.shallowCopy(),collectionName);
- slicesCopy.put(slice.getName(), newSlice);
+ sliceEntry.setValue(newSlice);
}
if (needToUpdateCollection) {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
index f1a5ac27934..6cdb938a9f8 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
@@ -60,19 +60,21 @@ public class PlacementModificationException extends PlacementException {
}
@Override
- public String toString() {
- StringBuilder sb = new StringBuilder(super.toString());
- if (!rejectedModifications.isEmpty()) {
- sb.append(": ")
- .append(rejectedModifications.size())
- .append(" rejections:");
- rejectedModifications.forEach((modification, reason) ->
- sb.append("\n")
- .append(modification)
- .append("\t")
- .append(reason));
-
+ public String getMessage() {
+ if (rejectedModifications.isEmpty()) {
+ return super.getMessage();
}
+
+ StringBuilder sb = new StringBuilder(super.getMessage());
+ sb.append(": ")
+ .append(rejectedModifications.size())
+ .append(" rejections:");
+ rejectedModifications.forEach((modification, reason) ->
+ sb.append("\n")
+ .append(modification)
+ .append("\t")
+ .append(reason));
+
return sb.toString();
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
index 9de8698af50..bf6659e51a5 100644
--- a/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
+++ b/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
@@ -63,7 +63,7 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
* {@link #onCommit} on our {@link #getWrappedDeletionPolicy()}.
*
* <p>
- * This map is atomically replaced by {@linke #updateKnownCommitPoints}.
+ * This map is atomically replaced by {@link #updateKnownCommitPoints}.
* The keys are the {@link IndexCommit#getGeneration} of each commit
* </p>
*
diff --git a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
index a75aaafb484..95a17bfb4fe 100644
--- a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
@@ -112,7 +112,7 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
payload = SimplePostTool.inputStreamToByteArray(is, maxSize);
}
MessageDigest m = MessageDigest.getInstance("MD5");
- m.update(payload.array(), payload.position(), payload.limit());
+ m.update(payload.array(), payload.arrayOffset() + payload.position(), payload.limit());
String md5 = new String(Hex.encodeHex(m.digest()));
int duplicateCount = req.getSearcher().count(new TermQuery(new Term("md5", md5)));
@@ -191,7 +191,7 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
//should never happen unless a user wrote this document directly
throw new SolrException(SolrException.ErrorCode.NOT_FOUND, "Invalid document . No field called blob");
} else {
- os.write(buf.array(), 0, buf.limit());
+ os.write(buf.array(), buf.arrayOffset(), buf.limit());
}
}
});
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index e3f9e953387..65b50c30d4c 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -1055,7 +1055,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
String prop = entry.getKey();
if ("".equals(entry.getValue())) {
// set to an empty string is equivalent to removing the property, see SOLR-12507
- m.put(prop, null);
+ entry.setValue(null);
}
DocCollection.verifyProp(m, prop);
}
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
index 8f5f3c53012..8b651845aff 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
@@ -134,15 +134,15 @@ class SolrRules {
return result;
}
- private static final Predicate<RelNode> FILTER_PREDICATE = relNode -> {
+ private static boolean filter(RelNode relNode) {
List<RexNode> filterOperands = ((RexCall) ((LogicalFilter) relNode).getCondition()).getOperands();
return isNotFilterByExpr(filterOperands, SolrRules.solrFieldNames(relNode.getRowType()));
- };
+ }
private static final SolrFilterRule FILTER_RULE = new SolrFilterRule();
private SolrFilterRule() {
- super(LogicalFilter.class, FILTER_PREDICATE, "SolrFilterRule");
+ super(LogicalFilter.class, SolrFilterRule::filter, "SolrFilterRule");
}
public RelNode convert(RelNode rel) {
diff --git a/solr/core/src/java/org/apache/solr/pkg/PackageLoader.java b/solr/core/src/java/org/apache/solr/pkg/PackageLoader.java
index 2d7d22faa8b..b73be8ca7dd 100644
--- a/solr/core/src/java/org/apache/solr/pkg/PackageLoader.java
+++ b/solr/core/src/java/org/apache/solr/pkg/PackageLoader.java
@@ -360,6 +360,7 @@ public class PackageLoader implements Closeable {
}
}
+ @SuppressWarnings("CompareToZero") // TODO either document why or fix this
private static String findBiggest(String lessThan, List<String> sortedList) {
String latest = null;
for (String v : sortedList) {
diff --git a/solr/core/src/java/org/apache/solr/schema/BinaryField.java b/solr/core/src/java/org/apache/solr/schema/BinaryField.java
index 8951e9e2ee5..caeb0a30525 100644
--- a/solr/core/src/java/org/apache/solr/schema/BinaryField.java
+++ b/solr/core/src/java/org/apache/solr/schema/BinaryField.java
@@ -44,7 +44,7 @@ public class BinaryField extends FieldType {
}
private String toBase64String(ByteBuffer buf) {
- return Base64.byteArrayToBase64(buf.array(), buf.position(), buf.limit()-buf.position());
+ return Base64.byteArrayToBase64(buf.array(), buf.arrayOffset() + buf.position(), buf.limit()-buf.position());
}
@Override
@@ -93,7 +93,7 @@ public class BinaryField extends FieldType {
} else if (val instanceof ByteBuffer && ((ByteBuffer)val).hasArray()) {
ByteBuffer byteBuf = (ByteBuffer) val;
buf = byteBuf.array();
- offset = byteBuf.position();
+ offset = byteBuf.arrayOffset() + byteBuf.position();
len = byteBuf.limit() - byteBuf.position();
} else {
String strVal = val.toString();
diff --git a/solr/core/src/java/org/apache/solr/schema/RankField.java b/solr/core/src/java/org/apache/solr/schema/RankField.java
index d11d5ed2874..e1d8fca4d9c 100644
--- a/solr/core/src/java/org/apache/solr/schema/RankField.java
+++ b/solr/core/src/java/org/apache/solr/schema/RankField.java
@@ -70,7 +70,7 @@ public class RankField extends FieldType {
@Override
public Type getUninversionType(SchemaField sf) {
- throw null;
+ throw new UnsupportedOperationException();
}
@Override
diff --git a/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java b/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
index c1c8bccf148..e954587ea80 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
@@ -115,7 +115,7 @@ public class RelatednessAgg extends AggValueSource {
RelatednessAgg that = (RelatednessAgg) o;
return Objects.equals(fgQ, that.fgQ)
&& Objects.equals(bgQ, that.bgQ)
- && Objects.equals(min_pop, that.min_pop);
+ && min_pop == that.min_pop;
}
@Override
@@ -525,11 +525,11 @@ public class RelatednessAgg extends AggValueSource {
}
BucketData that = (BucketData)other;
// we will most certainly be compared to other buckets of the same Agg instance, so compare counts first
- return Objects.equals(this.implied, that.implied)
- && Objects.equals(this.fg_count, that.fg_count)
- && Objects.equals(this.bg_count, that.bg_count)
- && Objects.equals(this.fg_size, that.fg_size)
- && Objects.equals(this.bg_size, that.bg_size)
+ return this.implied == that.implied
+ && this.fg_count == that.fg_count
+ && this.bg_count == that.bg_count
+ && this.fg_size == that.fg_size
+ && this.bg_size == that.bg_size
&& Objects.equals(this.agg, that.agg);
}
diff --git a/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java b/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
index 272f7778432..5967c985bb8 100644
--- a/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
+++ b/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
@@ -363,7 +363,7 @@ public class CrossCollectionJoinQuery extends Query {
Objects.equals(collection, other.collection) &&
Objects.equals(fromField, other.fromField) &&
Objects.equals(toField, other.toField) &&
- Objects.equals(routedByJoinKey, other.routedByJoinKey) &&
+ routedByJoinKey == other.routedByJoinKey &&
Objects.equals(otherParamsString, other.otherParamsString) &&
TimeUnit.SECONDS.convert(Math.abs(timestamp - other.timestamp), TimeUnit.NANOSECONDS) < Math.min(ttl, other.ttl);
}
diff --git a/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java b/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
index 513c565a35b..35267a028c6 100644
--- a/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
+++ b/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
@@ -128,9 +128,7 @@ public class HashRangeQuery extends Query {
}
private boolean equalsTo(HashRangeQuery other) {
- return Objects.equals(field, other.field) &&
- Objects.equals(lower, other.lower) &&
- Objects.equals(upper, other.upper);
+ return lower == other.lower && upper == other.upper && Objects.equals(field, other.field);
}
@Override
diff --git a/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessor.java
index a1f61d14f45..d0cc6d709f4 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/TolerantUpdateProcessor.java
@@ -301,9 +301,8 @@ public class TolerantUpdateProcessor extends UpdateRequestProcessor {
}
/**
- * Returns the output of {@link org.apache.solr.schema.FieldType#
- * indexedToReadable(BytesRef, CharsRefBuilder)} of the field
- * type of the uniqueKey on the {@link BytesRef} passed as parameter.
+ * Returns the output of {@link org.apache.solr.schema.FieldType#indexedToReadable(BytesRef, CharsRefBuilder)}
+ * of the field type of the uniqueKey on the {@link BytesRef} passed as parameter.
* <code>ref</code> should be the indexed representation of the id -- if null
* (possibly because it's missing in the update) this method will return {@link #UNKNOWN_ID}
*/
diff --git a/solr/core/src/java/org/apache/solr/util/CryptoKeys.java b/solr/core/src/java/org/apache/solr/util/CryptoKeys.java
index 0a98b694478..8ec507d4868 100644
--- a/solr/core/src/java/org/apache/solr/util/CryptoKeys.java
+++ b/solr/core/src/java/org/apache/solr/util/CryptoKeys.java
@@ -290,7 +290,7 @@ public final class CryptoKeys {
// See: https://crypto.stackexchange.com/questions/20085/which-attacks-are-possible-against-raw-textbook-rsa
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
rsaCipher.init(Cipher.ENCRYPT_MODE, privateKey);
- return rsaCipher.doFinal(buffer.array(),buffer.position(), buffer.limit());
+ return rsaCipher.doFinal(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.limit());
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,e);
}
diff --git a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
index d38ec52b99a..743fdf80e52 100644
--- a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
+++ b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
@@ -622,14 +622,15 @@ public class SimplePostTool {
URL postUrl = new URL(appendParam(solrUrl.toString(),
"literal.id="+URLEncoder.encode(u.toString(),"UTF-8") +
"&literal.url="+URLEncoder.encode(u.toString(),"UTF-8")));
- boolean success = postData(new ByteArrayInputStream(result.content.array(), result.content.arrayOffset(),result.content.limit() ), null, out, result.contentType, postUrl);
+ ByteBuffer content = result.content;
+ boolean success = postData(new ByteArrayInputStream(content.array(), content.arrayOffset(), content.limit()), null, out, result.contentType, postUrl);
if (success) {
info("POSTed web resource "+u+" (depth: "+level+")");
Thread.sleep(delay * 1000);
numPages++;
// Pull links from HTML pages only
if(recursive > level && result.contentType.equals("text/html")) {
- Set<URL> children = pageFetcher.getLinksFromWebPage(u, new ByteArrayInputStream(result.content.array(), result.content.arrayOffset(), result.content.limit()), result.contentType, postUrl);
+ Set<URL> children = pageFetcher.getLinksFromWebPage(u, new ByteArrayInputStream(content.array(), content.arrayOffset(), content.limit()), result.contentType, postUrl);
subStack.addAll(children);
}
} else {
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java
index 6a00f6ff3e0..11ec68ea0e9 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestBaseStatsCacheCloud.java
@@ -202,9 +202,9 @@ public abstract class TestBaseStatsCacheCloud extends SolrCloudTestCase {
Float controlScore = (Float) controlDoc.getFieldValue("score");
Float cloudScore = (Float) cloudDoc.getFieldValue("score");
if (sameScores) {
- assertEquals("cloud score differs from control", controlScore, cloudScore, controlScore * 0.01f);
+ assertEquals("cloud score differs from control", controlScore, cloudScore, controlScore * 0.001f);
} else {
- assertFalse("cloud score the same as control", controlScore == cloudScore);
+ assertNotEquals("cloud score is the same as control", controlScore, cloudScore, controlScore * 0.001f);
}
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java
index 945446f21cd..060ad9cfa70 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java
@@ -194,14 +194,14 @@ public class TestReplicaProperties extends ReplicaPropertiesBase {
lastFailMsg = "";
ClusterState clusterState = client.getZkStateReader().getClusterState();
for (Slice slice : clusterState.getCollection(collectionName).getSlices()) {
- Boolean foundLeader = false;
- Boolean foundPreferred = false;
+ boolean foundLeader = false;
+ boolean foundPreferred = false;
for (Replica replica : slice.getReplicas()) {
- Boolean isLeader = replica.getBool("leader", false);
- Boolean isPreferred = replica.getBool("property.preferredleader", false);
+ boolean isLeader = replica.getBool("leader", false);
+ boolean isPreferred = replica.getBool("property.preferredleader", false);
if (isLeader != isPreferred) {
- lastFailMsg = "Replica should NOT have preferredLeader != leader. Preferred: " + isPreferred.toString() +
- " leader is " + isLeader.toString();
+ lastFailMsg = "Replica should NOT have preferredLeader != leader. Preferred: " + isPreferred +
+ " leader is " + isLeader;
}
if (foundLeader && isLeader) {
lastFailMsg = "There should only be a single leader in _any_ shard! Replica " + replica.getName() +
diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
index 728b9f31f28..e760c205bf6 100644
--- a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
+++ b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
@@ -93,7 +93,7 @@ public class TestSolrConfigHandler extends RestTestBase {
public static ByteBuffer persistZip(String loc, Class<?>... classes) throws IOException {
ByteBuffer jar = generateZip(classes);
try (FileOutputStream fos = new FileOutputStream(loc)){
- fos.write(jar.array(), 0, jar.limit());
+ fos.write(jar.array(), jar.arrayOffset(), jar.limit());
fos.flush();
}
return jar;
@@ -108,7 +108,7 @@ public class TestSolrConfigHandler extends RestTestBase {
ZipEntry entry = new ZipEntry(path);
ByteBuffer b = SimplePostTool.inputStreamToByteArray(c.getClassLoader().getResourceAsStream(path));
zipOut.putNextEntry(entry);
- zipOut.write(b.array(), 0, b.limit());
+ zipOut.write(b.array(), b.arrayOffset(), b.limit());
zipOut.closeEntry();
}
}
diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotLargeTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotLargeTest.java
index e4f10db76b1..7dd4de27c00 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotLargeTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotLargeTest.java
@@ -810,7 +810,7 @@ public class DistributedFacetPivotLargeTest extends BaseDistributedSearchTestCas
assertEquals(257, (long) cardiffStatsInfo.getCount());
assertEquals(0, (long) cardiffStatsInfo.getMissing());
assertEquals(347554.0, cardiffStatsInfo.getSum());
- assertEquals(8.20968772E8, cardiffStatsInfo.getSumOfSquares(), 0.1E-7);
+ assertEquals(820968772, cardiffStatsInfo.getSumOfSquares(), 0);
assertEquals(1352.35019455253, (double) cardiffStatsInfo.getMean(), 0.1E-7);
assertEquals(1170.86048165857, cardiffStatsInfo.getStddev(), 0.1E-7);
@@ -824,7 +824,7 @@ public class DistributedFacetPivotLargeTest extends BaseDistributedSearchTestCas
assertEquals(101, (long) bbcCardifftPivotFieldStatsInfo.getCount());
assertEquals(0, (long) bbcCardifftPivotFieldStatsInfo.getMissing());
assertEquals(248742.0, bbcCardifftPivotFieldStatsInfo.getSum());
- assertEquals(6.52422564E8, bbcCardifftPivotFieldStatsInfo.getSumOfSquares(), 0.1E-7);
+ assertEquals(652422564, bbcCardifftPivotFieldStatsInfo.getSumOfSquares(), 0);
assertEquals(2462.792079208, (double) bbcCardifftPivotFieldStatsInfo.getMean(), 0.1E-7);
assertEquals(631.0525860312, bbcCardifftPivotFieldStatsInfo.getStddev(), 0.1E-7);
@@ -840,7 +840,7 @@ public class DistributedFacetPivotLargeTest extends BaseDistributedSearchTestCas
assertEquals(6, (long) placeholder0PivotFieldStatsInfo.getCount());
assertEquals(0, (long) placeholder0PivotFieldStatsInfo.getMissing());
assertEquals(22700.0, placeholder0PivotFieldStatsInfo.getSum());
- assertEquals(1.0105E8, placeholder0PivotFieldStatsInfo.getSumOfSquares(), 0.1E-7);
+ assertEquals(1.0105E8, placeholder0PivotFieldStatsInfo.getSumOfSquares(), 0);
assertEquals(3783.333333333, (double) placeholder0PivotFieldStatsInfo.getMean(), 0.1E-7);
assertEquals(1741.742422595, placeholder0PivotFieldStatsInfo.getStddev(), 0.1E-7);
@@ -855,7 +855,7 @@ public class DistributedFacetPivotLargeTest extends BaseDistributedSearchTestCas
assertEquals(6, (long) microsoftPlaceholder0PivotFieldStatsInfo.getCount());
assertEquals(0, (long) microsoftPlaceholder0PivotFieldStatsInfo.getMissing());
assertEquals(22700.0, microsoftPlaceholder0PivotFieldStatsInfo.getSum());
- assertEquals(1.0105E8, microsoftPlaceholder0PivotFieldStatsInfo.getSumOfSquares(), 0.1E-7);
+ assertEquals(1.0105E8, microsoftPlaceholder0PivotFieldStatsInfo.getSumOfSquares(), 0);
assertEquals(3783.333333333, (double) microsoftPlaceholder0PivotFieldStatsInfo.getMean(), 0.1E-7);
assertEquals(1741.742422595, microsoftPlaceholder0PivotFieldStatsInfo.getStddev(), 0.1E-7);
}
diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
index 77ef0bc531f..54609a80739 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
@@ -1605,7 +1605,7 @@ public class DistributedFacetPivotSmallTest extends BaseDistributedSearchTestCas
if (getFacetQuery().size() != other.getFacetQuery().size()) return false;
for (Map.Entry<String,Integer> entry : getFacetQuery().entrySet()) {
Integer otherQCount = other.getFacetQuery().get(entry.getKey());
- if (otherQCount == null || otherQCount != entry.getValue()) return false;
+ if (otherQCount == null || !otherQCount.equals(entry.getValue())) return false;
}
}
return true;
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestPivotHelperCode.java b/solr/core/src/test/org/apache/solr/handler/component/TestPivotHelperCode.java
index d53d218926a..89bb8309774 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TestPivotHelperCode.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TestPivotHelperCode.java
@@ -88,6 +88,7 @@ public class TestPivotHelperCode extends SolrTestCaseJ4{
@SuppressForbidden(reason = "Checking object equality for Long instance")
+ @SuppressWarnings("BoxedPrimitiveConstructor")
public void testCompareWithNullLast() throws Exception {
Long a = random().nextLong();
Long b = random().nextLong();
diff --git a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
index 8fc209530ed..de682363c92 100644
--- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
+++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
@@ -772,6 +772,7 @@ public class TestPackages extends SolrCloudTestCase {
public static void postFileAndWait(MiniSolrCloudCluster cluster, String fname, String path, String sig) throws Exception {
ByteBuffer fileContent = getFileContent(fname);
+ @SuppressWarnings("ByteBufferBackingArray") // this is the result of a call to wrap()
String sha512 = DigestUtils.sha512Hex(fileContent.array());
TestDistribPackageStore.postFile(cluster.getSolrClient(),
@@ -819,7 +820,7 @@ public class TestPackages extends SolrCloudTestCase {
public static ByteBuffer persistZip(String loc, Class<?>... classes) throws IOException {
ByteBuffer jar = generateZip(classes);
try (FileOutputStream fos = new FileOutputStream(loc)) {
- fos.write(jar.array(), 0, jar.limit());
+ fos.write(jar.array(), jar.arrayOffset(), jar.limit());
fos.flush();
}
return jar;
@@ -834,7 +835,7 @@ public class TestPackages extends SolrCloudTestCase {
ZipEntry entry = new ZipEntry(path);
ByteBuffer b = SimplePostTool.inputStreamToByteArray(c.getClassLoader().getResourceAsStream(path));
zipOut.putNextEntry(entry);
- zipOut.write(b.array(), 0, b.limit());
+ zipOut.write(b.array(), b.arrayOffset(), b.limit());
zipOut.closeEntry();
}
}
diff --git a/solr/core/src/test/org/apache/solr/response/TestBinaryResponseWriter.java b/solr/core/src/test/org/apache/solr/response/TestBinaryResponseWriter.java
index a14939c98bd..99a11fdc03e 100644
--- a/solr/core/src/test/org/apache/solr/response/TestBinaryResponseWriter.java
+++ b/solr/core/src/test/org/apache/solr/response/TestBinaryResponseWriter.java
@@ -75,7 +75,7 @@ public class TestBinaryResponseWriter extends SolrTestCaseJ4 {
SimplePostTool.BAOS baos = new SimplePostTool.BAOS();
new JavaBinCodec(new BinaryResponseWriter.Resolver(null, null)).marshal(nl, baos);
ByteBuffer byteBuffer = baos.getByteBuffer();
- NamedList<?> result = (NamedList<?>) new JavaBinCodec().unmarshal(new ByteArrayInputStream(byteBuffer.array(), 0, byteBuffer.limit()));
+ NamedList<?> result = (NamedList<?>) new JavaBinCodec().unmarshal(new ByteArrayInputStream(byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.limit()));
assertEquals(text, result._get("doc1/desc", null));
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
index 2a3dea8ce91..b38de13f216 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
@@ -87,13 +87,16 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
// replace \0 with the field name and create a parsable string
public String func(String field, String template) {
- StringBuilder sb = new StringBuilder("{!func}");
- for (char ch : template.toCharArray()) {
- if (ch=='\0') {
+ int size = 7 + field.length() + template.length();
+ StringBuilder sb = new StringBuilder(size);
+ sb.append("{!func}");
+ for (int i = 0; i < template.length(); i++) {
+ char ch = template.charAt(i);
+ if (ch != '\0') {
+ sb.append(ch);
+ } else {
sb.append(field);
- continue;
}
- sb.append(ch);
}
return sb.toString();
}
diff --git a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java
index 29b9c9ddaf3..2f7dedac8f6 100644
--- a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java
+++ b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java
@@ -50,9 +50,13 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
// Given an ID, returns an XML string for an "add document" request
- private static final Function<Integer, String> ADD_DOC_FN = (id) -> adoc("id", Integer.toString(id));
+ private static String addDoc(int id) {
+ return adoc("id", Integer.toString(id));
+ }
// Given an ID, returns an XML string for a "delete document" request
- private static final Function<Integer, String> DELETE_DOC_FN = (id) -> delI(Integer.toString(id));
+ private static String delDoc(int id) {
+ return delI(Integer.toString(id));
+ }
// How long to sleep while checking for commits
private static final int COMMIT_CHECKING_SLEEP_TIME_MS = 50;
// max TLOG file size
@@ -189,7 +193,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {
* @return a SolrQueryRequestBase
*/
private SolrQueryRequestBase constructBatchAddDocRequest(int startId, int batchSize) {
- return constructBatchRequestHelper(startId, batchSize, ADD_DOC_FN);
+ return constructBatchRequestHelper(startId, batchSize, MaxSizeAutoCommitTest::addDoc);
}
/**
@@ -199,7 +203,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {
* @return a SolrQueryRequestBase
*/
private SolrQueryRequestBase constructBatchDeleteDocRequest(int startId, int batchSize) {
- return constructBatchRequestHelper(startId, batchSize, DELETE_DOC_FN);
+ return constructBatchRequestHelper(startId, batchSize, MaxSizeAutoCommitTest::delDoc);
}
/**
diff --git a/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java b/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
index 168db8de938..8b04101feb5 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
@@ -985,9 +985,9 @@ public class ParsingFieldUpdateProcessorsTest extends UpdateProcessorTestBase {
.withZone(ZoneId.of("UTC")).parse(inputString, Instant::from).toEpochMilli());
// ensure english locale and root locale return the same date
- assertEquals(expectTs, DateTimeFormatter.ofPattern(dateFormat, Locale.ENGLISH)
+ assertEquals(expectTs + "", DateTimeFormatter.ofPattern(dateFormat, Locale.ENGLISH)
.withZone(ZoneId.of("UTC")).parse(inputString, Instant::from).toEpochMilli(),
- DateTimeFormatter.ofPattern(dateFormat, Locale.ENGLISH)
+ DateTimeFormatter.ofPattern(dateFormat, Locale.ROOT)
.withZone(ZoneId.of("UTC")).parse(inputString, Instant::from).toEpochMilli());
assertParsedDate(inputString, Date.from(Instant.ofEpochMilli(expectTs)), "parse-date-patterns-default-config");
diff --git a/solr/licenses/error_prone_annotations-2.5.1.jar.sha1 b/solr/licenses/error_prone_annotations-2.5.1.jar.sha1
deleted file mode 100644
index af41bede543..00000000000
--- a/solr/licenses/error_prone_annotations-2.5.1.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-562d366678b89ce5d6b6b82c1a073880341e3fba
diff --git a/solr/licenses/error_prone_annotations-2.8.1.jar.sha1 b/solr/licenses/error_prone_annotations-2.8.1.jar.sha1
new file mode 100644
index 00000000000..215a74ece5e
--- /dev/null
+++ b/solr/licenses/error_prone_annotations-2.8.1.jar.sha1
@@ -0,0 +1 @@
+bbfa4bdfe7377126947f1469bc7b0bbb4d9dbb95
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java b/solr/solrj/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
index d77a1db93d6..10066e3087b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
@@ -31,9 +31,9 @@ public class SSLConfig {
private String trustStore;
private String trustStorePassword;
- /** NOTE: all other settings are ignored if useSSL is false; trustStore settings are ignored if clientAuth is false */
- public SSLConfig(boolean useSSL, boolean clientAuth, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword) {
- this.useSsl = useSSL;
+ /** NOTE: all other settings are ignored if useSsl is false; trustStore settings are ignored if clientAuth is false */
+ public SSLConfig(boolean useSsl, boolean clientAuth, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword) {
+ this.useSsl = useSsl;
this.clientAuth = clientAuth;
this.keyStore = keyStore;
this.keyStorePassword = keyStorePassword;
@@ -41,8 +41,8 @@ public class SSLConfig {
this.trustStorePassword = trustStorePassword;
}
- public void setUseSSL(boolean useSSL) {
- this.useSsl = useSSL;
+ public void setUseSSL(boolean useSsl) {
+ this.useSsl = useSsl;
}
public void setClientAuth(boolean clientAuth) {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RawValueEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RawValueEvaluator.java
index 026f8a29279..32cfaf0fa46 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RawValueEvaluator.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RawValueEvaluator.java
@@ -54,7 +54,7 @@ public class RawValueEvaluator extends SourceEvaluator {
private void init(Object value){
if(value instanceof Integer){
- this.value = (Long)value;
+ this.value = ((Integer)value).longValue();
}
else if(value instanceof Float){
this.value = ((Float)value).doubleValue();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
index 20bae0e359d..e60bc39b6e5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
@@ -413,8 +413,9 @@ public class UpdateRequest extends AbstractUpdateRequest {
overwrite = (Boolean) entry.getValue().get(OVERWRITE);
commitWithin = (Integer) entry.getValue().get(COMMIT_WITHIN);
}
- if (overwrite != lastOverwrite || commitWithin != lastCommitWithin
- || docLists.size() == 0) {
+ if (!Objects.equals(overwrite, lastOverwrite)
+ || !Objects.equals(commitWithin, lastCommitWithin)
+ || docLists.isEmpty()) {
docList = new LinkedHashMap<>();
docLists.add(docList);
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
index 9afe1bd2747..b96a8cb990d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
@@ -113,7 +113,7 @@ public class ClientUtils
v = Base64.byteArrayToBase64(bytes, 0, bytes.length);
} else if (v instanceof ByteBuffer) {
ByteBuffer bytes = (ByteBuffer) v;
- v = Base64.byteArrayToBase64(bytes.array(), bytes.position(),bytes.limit() - bytes.position());
+ v = Base64.byteArrayToBase64(bytes.array(), bytes.arrayOffset() + bytes.position(),bytes.limit() - bytes.position());
}
XML.Writable valWriter = null;
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
index d818b3a2cf3..1507a43fa43 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
@@ -169,11 +169,7 @@ public class SolrException extends RuntimeException {
log.error(msg);
}
- // public String toString() { return toStr(this); } // oops, inf loop
- @Override
- public String toString() { return super.toString(); }
-
- public static String toStr(Throwable e) {
+ public static String toStr(Throwable e) {
CharArrayWriter cw = new CharArrayWriter();
PrintWriter pw = new PrintWriter(cw);
e.printStackTrace(pw);
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 649ea682f32..ac49a684e72 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -1086,7 +1086,7 @@ public class JavaBinCodec implements PushWriter {
return true;
} else if (val instanceof ByteBuffer) {
ByteBuffer buf = (ByteBuffer) val;
- writeByteArray(buf.array(),buf.position(),buf.limit() - buf.position());
+ writeByteArray(buf.array(), buf.arrayOffset() + buf.position(),buf.limit() - buf.position());
return true;
} else if (val == END_OBJ) {
writeTag(END);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
index c1d327abdfc..a31d0772d7f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
@@ -67,7 +67,7 @@ public class SolrExampleStreamingTest extends SolrExampleTests {
public void testWaitOptions() throws Exception {
// SOLR-3903
- final List<Throwable> failures = new ArrayList<>();
+ final List<Throwable> failures = new ArrayList<>(); // TODO these failures are not the same as recorded by the client
final String serverUrl = jetty.getBaseUrl().toString() + "/collection1";
try (ConcurrentUpdateSolrClient concurrentClient = new FailureRecordingConcurrentUpdateSolrClient.Builder(serverUrl)
.withQueueSize(2)
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
index 445177884aa..c50e9e31620 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java
@@ -772,21 +772,21 @@ public class JdbcTest extends SolrCloudTestCase {
assertFalse(rs.wasNull());
assertEquals(10F, rs.getFloat(4), 0);
assertFalse(rs.wasNull());
- assertEquals(10, rs.getInt("my_float_col"), 0);
+ assertEquals(10, rs.getInt("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getInt(4), 0);
+ assertEquals(10, rs.getInt(4));
assertFalse(rs.wasNull());
- assertEquals(10L, rs.getLong("my_float_col"), 0);
+ assertEquals(10L, rs.getLong("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(10L, rs.getLong(4), 0);
+ assertEquals(10L, rs.getLong(4));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getShort("my_float_col"), 0);
+ assertEquals(10, rs.getShort("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getShort(4), 0);
+ assertEquals(10, rs.getShort(4));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getByte("my_float_col"), 0);
+ assertEquals(10, rs.getByte("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getByte(4), 0);
+ assertEquals(10, rs.getByte(4));
assertFalse(rs.wasNull());
assertEquals(10L, rs.getObject("testnull_i"));
@@ -805,21 +805,21 @@ public class JdbcTest extends SolrCloudTestCase {
assertFalse(rs.wasNull());
assertEquals(10F, rs.getFloat(5), 0);
assertFalse(rs.wasNull());
- assertEquals(10, rs.getInt("testnull_i"), 0);
+ assertEquals(10, rs.getInt("testnull_i"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getInt(5), 0);
+ assertEquals(10, rs.getInt(5));
assertFalse(rs.wasNull());
- assertEquals(10L, rs.getLong("testnull_i"), 0);
+ assertEquals(10L, rs.getLong("testnull_i"));
assertFalse(rs.wasNull());
- assertEquals(10L, rs.getLong(5), 0);
+ assertEquals(10L, rs.getLong(5));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getShort("testnull_i"), 0);
+ assertEquals(10, rs.getShort("testnull_i"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getShort(5), 0);
+ assertEquals(10, rs.getShort(5));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getByte("testnull_i"), 0);
+ assertEquals(10, rs.getByte("testnull_i"));
assertFalse(rs.wasNull());
- assertEquals(10, rs.getByte(5), 0);
+ assertEquals(10, rs.getByte(5));
assertFalse(rs.wasNull());
@@ -871,21 +871,21 @@ public class JdbcTest extends SolrCloudTestCase {
assertFalse(rs.wasNull());
assertEquals(9F, rs.getFloat(4), 0);
assertFalse(rs.wasNull());
- assertEquals(9, rs.getInt("my_float_col"), 0);
+ assertEquals(9, rs.getInt("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(9, rs.getInt(4), 0);
+ assertEquals(9, rs.getInt(4));
assertFalse(rs.wasNull());
- assertEquals(9L, rs.getLong("my_float_col"), 0);
+ assertEquals(9L, rs.getLong("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(9L, rs.getLong(4), 0);
+ assertEquals(9L, rs.getLong(4));
assertFalse(rs.wasNull());
- assertEquals(9, rs.getShort("my_float_col"), 0);
+ assertEquals(9, rs.getShort("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(9, rs.getShort(4), 0);
+ assertEquals(9, rs.getShort(4));
assertFalse(rs.wasNull());
- assertEquals(9, rs.getByte("my_float_col"), 0);
+ assertEquals(9, rs.getByte("my_float_col"));
assertFalse(rs.wasNull());
- assertEquals(9, rs.getByte(4), 0);
+ assertEquals(9, rs.getByte(4));
assertFalse(rs.wasNull());
assertEquals(null, rs.getObject("testnull_i"));
diff --git a/versions.lock b/versions.lock
index 6f2d1991196..484d5448948 100644
--- a/versions.lock
+++ b/versions.lock
@@ -30,7 +30,7 @@ com.google.cloud:google-cloud-storage:1.113.14 (2 constraints: 10143aa3)
com.google.code.findbugs:annotations:3.0.1 (1 constraints: 0605fb35)
com.google.code.findbugs:jsr305:3.0.2 (9 constraints: 057f5545)
com.google.code.gson:gson:2.8.6 (4 constraints: 94389e56)
-com.google.errorprone:error_prone_annotations:2.5.1 (4 constraints: 982fbe55)
+com.google.errorprone:error_prone_annotations:2.8.1 (4 constraints: 9d2f3758)
com.google.guava:failureaccess:1.0.1 (1 constraints: e60fd595)
com.google.guava:guava:25.1-jre (1 constraints: 4a06b047)
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (1 constraints: 8f1d45cb)
diff --git a/versions.props b/versions.props
index fee08a8d473..b5a005f97b7 100644
--- a/versions.props
+++ b/versions.props
@@ -23,7 +23,7 @@ com.google.cloud:google-cloud-core=1.77.0
com.google.cloud:google-cloud-nio=0.122.11
com.google.cloud:google-cloud-storage=1.77.0
com.google.code.gson:gson=2.7
-com.google.errorprone:*=2.4.0
+com.google.errorprone:*=2.8.1
com.google.guava:guava=25.1-jre
com.google.http-client:google-http-client-appengine=1.29.2
com.google.http-client:google-http-client-jackson2=1.29.2
@@ -127,4 +127,4 @@ org.threeten:threetenbp=1.3.3
org.tukaani:xz=1.8
org.xerial.snappy:snappy-java=1.1.7.6
ua.net.nlp:morfologik-ukrainian-search=4.9.1
-xerces:xercesImpl=2.12.0
\ No newline at end of file
+xerces:xercesImpl=2.12.0