You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2020/11/24 14:21:27 UTC
[kafka] branch trunk updated: MINOR: Update build and test
dependencies (#9645)
This is an automated email from the ASF dual-hosted git repository.
ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new a5986bd MINOR: Update build and test dependencies (#9645)
a5986bd is described below
commit a5986bd32df94465b6202db02a52580aec0f348d
Author: Ismael Juma <is...@juma.me.uk>
AuthorDate: Tue Nov 24 06:20:05 2020 -0800
MINOR: Update build and test dependencies (#9645)
The spotbugs upgrade means we can re-enable
RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE and RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE.
These uncovered one bug, one unnecessary null check and one
false positive. Addressed them all, including a test for the bug.
* gradle (6.7.0 -> 6.7.1): minor fixes.
* gradle versions plugin (0.29.0 -> 0.36.0): minor fixes.
* grgit (4.0.2 -> 4.1.0): a few small fixes and dependency bumps.
* owasp dependency checker plugin (5.3.2.1 -> 6.0.3): improved db
schema, data and several fixes.
* scoverage plugin (4.0.2 -> 5.0.0): support Scala 2.13.
* shadow plugin (6.0.0 -> 6.1.0): require Java 8, support for Java 16.
* spotbugs plugin (4.4.4 -> 4.6.0): support SARIF reporting standard.
* spotbugs (4.0.6 -> 4.1.4): support for Java 16 and various fixes including
try with resources false positive.
* spotless plugin (5.1.0 -> 5.8.2): minor fixes.
* test retry plugin (1.1.6 -> 1.1.9): newer gradle and java version compatibility
fixes.
* mockito (3.5.7 -> 3.6.0): minor fixes.
* powermock (2.0.7 -> 2.0.9): minor fixes.
Release notes links:
* https://docs.gradle.org/6.7.1/release-notes.html
* https://github.com/spotbugs/spotbugs/blob/4.1.4/CHANGELOG.md
* https://github.com/scoverage/gradle-scoverage/releases/tag/5.0.0
* https://github.com/johnrengelman/shadow/releases/tag/6.1.0
* https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.6.0
* https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.6.0
* https://github.com/spotbugs/spotbugs-gradle-plugin/releases/tag/4.5.0
* https://github.com/ben-manes/gradle-versions-plugin/releases
* https://github.com/ajoberstar/grgit/releases/tag/4.1.0
* https://github.com/jeremylong/DependencyCheck/blob/main/RELEASE_NOTES.md#version-603-2020-11-03
* https://github.com/powermock/powermock/releases/tag/powermock-2.0.8
* https://github.com/powermock/powermock/releases/tag/powermock-2.0.9
* https://github.com/mockito/mockito/blob/v3.6.0/doc/release-notes/official.md
* https://github.com/gradle/test-retry-gradle-plugin/releases
* https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
.../apache/kafka/clients/admin/ScramMechanism.java | 12 ++++++--
.../common/header/internals/RecordHeader.java | 2 +-
.../kafka/clients/admin/ScramMechanismTest.java | 35 ++++++++++++++++++++++
gradle/dependencies.gradle | 24 +++++++--------
gradle/spotbugs-exclude.xml | 16 ++++------
gradle/wrapper/gradle-wrapper.properties | 2 +-
gradlew | 2 +-
7 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/ScramMechanism.java b/clients/src/main/java/org/apache/kafka/clients/admin/ScramMechanism.java
index 87e19b6..9869bc7 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/ScramMechanism.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/ScramMechanism.java
@@ -17,6 +17,8 @@
package org.apache.kafka.clients.admin;
+import java.util.Arrays;
+
/**
* Representation of a SASL/SCRAM Mechanism.
*
@@ -27,13 +29,15 @@ public enum ScramMechanism {
SCRAM_SHA_256((byte) 1),
SCRAM_SHA_512((byte) 2);
+ private static final ScramMechanism[] VALUES = values();
+
/**
*
* @param type the type indicator
* @return the instance corresponding to the given type indicator, otherwise {@link #UNKNOWN}
*/
public static ScramMechanism fromType(byte type) {
- for (ScramMechanism scramMechanism : ScramMechanism.values()) {
+ for (ScramMechanism scramMechanism : VALUES) {
if (scramMechanism.type == type) {
return scramMechanism;
}
@@ -49,8 +53,10 @@ public enum ScramMechanism {
* Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms, Section 4</a>
*/
public static ScramMechanism fromMechanismName(String mechanismName) {
- ScramMechanism retvalFoundMechanism = ScramMechanism.valueOf(mechanismName.replace('-', '_'));
- return retvalFoundMechanism != null ? retvalFoundMechanism : UNKNOWN;
+ return Arrays.stream(VALUES)
+ .filter(mechanism -> mechanism.mechanismName.equals(mechanismName))
+ .findFirst()
+ .orElse(UNKNOWN);
}
/**
diff --git a/clients/src/main/java/org/apache/kafka/common/header/internals/RecordHeader.java b/clients/src/main/java/org/apache/kafka/common/header/internals/RecordHeader.java
index d042494..2a29d9d 100644
--- a/clients/src/main/java/org/apache/kafka/common/header/internals/RecordHeader.java
+++ b/clients/src/main/java/org/apache/kafka/common/header/internals/RecordHeader.java
@@ -70,7 +70,7 @@ public class RecordHeader implements Header {
@Override
public int hashCode() {
- int result = key() != null ? key().hashCode() : 0;
+ int result = key().hashCode();
result = 31 * result + Arrays.hashCode(value());
return result;
}
diff --git a/clients/src/test/java/org/apache/kafka/clients/admin/ScramMechanismTest.java b/clients/src/test/java/org/apache/kafka/clients/admin/ScramMechanismTest.java
new file mode 100644
index 0000000..03ee051
--- /dev/null
+++ b/clients/src/test/java/org/apache/kafka/clients/admin/ScramMechanismTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.clients.admin;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
+
+class ScramMechanismTest {
+
+ @Test
+ public void testFromMechanismName() {
+ assertEquals(ScramMechanism.UNKNOWN, ScramMechanism.fromMechanismName("UNKNOWN"));
+ assertEquals(ScramMechanism.SCRAM_SHA_256, ScramMechanism.fromMechanismName("SCRAM-SHA-256"));
+ assertEquals(ScramMechanism.SCRAM_SHA_512, ScramMechanism.fromMechanismName("SCRAM-SHA-512"));
+ assertEquals(ScramMechanism.UNKNOWN, ScramMechanism.fromMechanismName("some string"));
+ assertEquals(ScramMechanism.UNKNOWN, ScramMechanism.fromMechanismName("scram-sha-256"));
+ }
+
+}
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index 671bb11..b96c25c 100644
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -61,9 +61,9 @@ versions += [
bcpkix: "1.66",
checkstyle: "8.20",
commonsCli: "1.4",
- gradle: "6.7",
- gradleVersionsPlugin: "0.29.0",
- grgit: "4.0.2",
+ gradle: "6.7.1",
+ gradleVersionsPlugin: "0.36.0",
+ grgit: "4.1.0",
httpclient: "4.5.12",
easymock: "4.2",
jackson: "2.10.5",
@@ -95,10 +95,10 @@ versions += [
lz4: "1.7.1",
mavenArtifact: "3.6.3",
metrics: "2.2.0",
- mockito: "3.5.7",
+ mockito: "3.6.0",
netty: "4.1.51.Final",
- owaspDepCheckPlugin: "5.3.2.1",
- powermock: "2.0.7",
+ owaspDepCheckPlugin: "6.0.3",
+ powermock: "2.0.9",
reflections: "0.9.12",
rocksDB: "5.18.4",
scalaCollectionCompat: "2.2.0",
@@ -106,14 +106,14 @@ versions += [
scalaJava8Compat : "0.9.1",
scalatest: "3.0.8",
scoverage: "1.4.1",
- scoveragePlugin: "4.0.2",
- shadowPlugin: "6.0.0",
+ scoveragePlugin: "5.0.0",
+ shadowPlugin: "6.1.0",
slf4j: "1.7.30",
snappy: "1.1.8.1",
- spotbugs: "4.0.6",
- spotbugsPlugin: "4.4.4",
- spotlessPlugin: "5.1.0",
- testRetryPlugin: "1.1.6",
+ spotbugs: "4.1.4",
+ spotbugsPlugin: "4.6.0",
+ spotlessPlugin: "5.8.2",
+ testRetryPlugin: "1.1.9",
zinc: "1.3.5",
zookeeper: "3.5.8",
zstd: "1.4.5-12"
diff --git a/gradle/spotbugs-exclude.xml b/gradle/spotbugs-exclude.xml
index 25adc87..f395d0a 100644
--- a/gradle/spotbugs-exclude.xml
+++ b/gradle/spotbugs-exclude.xml
@@ -24,16 +24,6 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
-->
<FindBugsFilter>
- <!-- false positive in Java 11, see https://github.com/spotbugs/spotbugs/issues/756 -->
- <Match>
- <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
- </Match>
-
- <!-- false positive in Java 11, see https://github.com/spotbugs/spotbugs/issues/756 -->
- <Match>
- <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
- </Match>
-
<Match>
<!-- Disable warnings about mutable objects and the use of public fields.
EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object
@@ -103,6 +93,12 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
</Or>
</Match>
+ <!-- false positive in Java 11, related to https://github.com/spotbugs/spotbugs/issues/756 but more complex -->
+ <Match>
+ <Class name="org.apache.kafka.common.record.KafkaLZ4BlockOutputStream"/>
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
+ </Match>
+
<Match>
<!-- Suppression for the equals() for extension methods. -->
<Class name="kafka.api.package$ElectLeadersRequestOps"/>
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 14e30f7..1f3fdbc 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 481772a..68e8dfe 100755
--- a/gradlew
+++ b/gradlew
@@ -84,7 +84,7 @@ esac
# Loop in case we encounter an error.
for attempt in 1 2 3; do
if [ ! -e $APP_HOME/gradle/wrapper/gradle-wrapper.jar ]; then
- if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v6.7.0/gradle/wrapper/gradle-wrapper.jar"; then
+ if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v6.7.1/gradle/wrapper/gradle-wrapper.jar"; then
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
# Pause for a bit before looping in case the server throttled us.
sleep 5