You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ma...@apache.org on 2019/04/05 18:01:04 UTC

[kafka] branch trunk updated: MINOR: Fixed a few warning in core and connects (#6545)

This is an automated email from the ASF dual-hosted git repository.

manikumar 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 825fa3f  MINOR: Fixed a few warning in core and connects (#6545)
825fa3f is described below

commit 825fa3fa09b89e9ba9d38a92c1b01bd170494efb
Author: Mickael Maison <mi...@users.noreply.github.com>
AuthorDate: Fri Apr 5 19:00:48 2019 +0100

    MINOR: Fixed a few warning in core and connects (#6545)
    
    - var -> val
    - unused imports
    - Javadoc fix
    
    Reviewers: Manikumar Reddy <ma...@gmail.com>
---
 .../api/src/main/java/org/apache/kafka/connect/header/Headers.java  | 2 +-
 .../test/scala/integration/kafka/api/IntegrationTestHarness.scala   | 1 -
 .../integration/kafka/network/DynamicConnectionQuotaTest.scala      | 6 +++---
 core/src/test/scala/unit/kafka/cluster/PartitionTest.scala          | 2 +-
 .../scala/unit/kafka/coordinator/group/GroupCoordinatorTest.scala   | 4 ++--
 core/src/test/scala/unit/kafka/utils/TestUtils.scala                | 4 ++--
 6 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/connect/api/src/main/java/org/apache/kafka/connect/header/Headers.java b/connect/api/src/main/java/org/apache/kafka/connect/header/Headers.java
index 761abe3..d7bd779 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/header/Headers.java
+++ b/connect/api/src/main/java/org/apache/kafka/connect/header/Headers.java
@@ -254,7 +254,7 @@ public interface Headers extends Iterable<Header> {
     Headers retainLatest(String key);
 
     /**
-     * Removes all but the last {@Header} object with each key.
+     * Removes all but the last {@link Header} object with each key.
      *
      * @return this object to facilitate chaining multiple methods; never null
      */
diff --git a/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala b/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
index 640244d..39f47ab 100644
--- a/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
+++ b/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
@@ -23,7 +23,6 @@ import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer}
 import kafka.utils.TestUtils
 import kafka.utils.Implicits._
 import java.util.Properties
-import java.util.concurrent.TimeUnit
 
 import org.apache.kafka.clients.producer.{KafkaProducer, ProducerConfig}
 import kafka.server.KafkaConfig
diff --git a/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala b/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala
index 514d879..41e1ff9 100644
--- a/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala
+++ b/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala
@@ -69,11 +69,11 @@ class DynamicConnectionQuotaTest extends BaseRequestTest {
   }
 
   @Test
-  def testDynamicConnectionQuota(): Unit = {
+  def testDynamicConnectionQuota() {
     val initialConnectionCount = connectionCount
     val maxConnectionsPerIP = 5
 
-    def connectAndVerify: Unit = {
+    def connectAndVerify() {
       val socket = connect()
       try {
         sendAndReceive(produceRequest, ApiKeys.PRODUCE, socket)
@@ -101,7 +101,7 @@ class DynamicConnectionQuotaTest extends BaseRequestTest {
     val socketServer = servers.head.socketServer
     val initialConnectionCount = connectionCount
 
-    def connectAndVerify(): Unit = {
+    def connectAndVerify() {
       val socket = connect("PLAINTEXT")
       socket.setSoTimeout(1000)
       try {
diff --git a/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala b/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
index 769cc67..e3f7b4d 100644
--- a/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
+++ b/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
@@ -228,7 +228,7 @@ class PartitionTest {
     logManager.maybeUpdatePreferredLogDir(topicPartition, logDir2.getAbsolutePath)
     val log2 = logManager.getOrCreateLog(topicPartition, logConfig, isFuture = true)
     val buffer = ByteBuffer.allocate(1024)
-    var builder = MemoryRecords.builder(buffer, RecordBatch.CURRENT_MAGIC_VALUE, CompressionType.NONE,
+    val builder = MemoryRecords.builder(buffer, RecordBatch.CURRENT_MAGIC_VALUE, CompressionType.NONE,
       TimestampType.CREATE_TIME, 0L, RecordBatch.NO_TIMESTAMP, 0)
     builder.appendWithOffset(2L, new SimpleRecord("k1".getBytes, "v3".getBytes))
     builder.appendWithOffset(5L, new SimpleRecord("k2".getBytes, "v6".getBytes))
diff --git a/core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorTest.scala b/core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorTest.scala
index a529750..cf76375 100644
--- a/core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorTest.scala
+++ b/core/src/test/scala/unit/kafka/coordinator/group/GroupCoordinatorTest.scala
@@ -195,7 +195,7 @@ class GroupCoordinatorTest extends JUnitSuite {
 
   @Test
   def testJoinGroupShouldReceiveErrorIfGroupOverMaxSize() {
-    var futures = ArrayBuffer[Future[JoinGroupResult]]()
+    val futures = ArrayBuffer[Future[JoinGroupResult]]()
     val rebalanceTimeout = GroupInitialRebalanceDelay * 2
 
     for (i <- 1.to(GroupMaxSize)) {
@@ -885,7 +885,7 @@ class GroupCoordinatorTest extends JUnitSuite {
 
     // create a pending member in the group
     EasyMock.reset(replicaManager)
-    var pendingMember = joinGroupPartial(groupId, JoinGroupRequest.UNKNOWN_MEMBER_ID, protocolType, protocols, sessionTimeout=100)
+    val pendingMember = joinGroupPartial(groupId, JoinGroupRequest.UNKNOWN_MEMBER_ID, protocolType, protocols, sessionTimeout=100)
     assertEquals(1, groupCoordinator.groupManager.getGroup(groupId).get.numPending)
 
     // re-join the second existing member
diff --git a/core/src/test/scala/unit/kafka/utils/TestUtils.scala b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
index 5dc7c8a..c84d75e 100755
--- a/core/src/test/scala/unit/kafka/utils/TestUtils.scala
+++ b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
@@ -308,7 +308,7 @@ object TestUtils extends Logging {
         adminZkClient.createTopic(topic, numPartitions, replicationFactor, topicConfig)
       } catch {
         case _: SessionExpiredException => hasSessionExpirationException = true
-        case e => throw e // let other exceptions propagate
+        case e: Throwable => throw e // let other exceptions propagate
       }
       !hasSessionExpirationException},
       s"Can't create topic $topic")
@@ -350,7 +350,7 @@ object TestUtils extends Logging {
         adminZkClient.createTopicWithAssignment(topic, topicConfig, partitionReplicaAssignment)
       } catch {
         case _: SessionExpiredException => hasSessionExpirationException = true
-        case e => throw e // let other exceptions propagate
+        case e: Throwable => throw e // let other exceptions propagate
       }
       !hasSessionExpirationException},
       s"Can't create topic $topic")