You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by va...@apache.org on 2019/01/20 21:25:45 UTC
[kafka] branch trunk updated: MINOR: Remove unused imports,
exceptions, and values (#6117)
This is an automated email from the ASF dual-hosted git repository.
vahid 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 e87e3f2 MINOR: Remove unused imports, exceptions, and values (#6117)
e87e3f2 is described below
commit e87e3f2cb286add0c315069b3b2a13c31d65043e
Author: Lee Dongjin <do...@apache.org>
AuthorDate: Mon Jan 21 06:25:35 2019 +0900
MINOR: Remove unused imports, exceptions, and values (#6117)
1. Remove unthrown exceptions from MemoryRecordsBuilderTest
2. Remove unused imports from ReplicaFetcherThread, ZooKeeperClient, ApiVersionTest, PartitionTest
3. Remove unused value from PartitionTest
---
.../org/apache/kafka/common/record/MemoryRecordsBuilderTest.java | 8 ++++----
core/src/main/scala/kafka/server/ReplicaFetcherThread.scala | 1 -
core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala | 1 -
core/src/test/scala/unit/kafka/api/ApiVersionTest.scala | 3 ---
core/src/test/scala/unit/kafka/cluster/PartitionTest.scala | 7 ++-----
5 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/clients/src/test/java/org/apache/kafka/common/record/MemoryRecordsBuilderTest.java b/clients/src/test/java/org/apache/kafka/common/record/MemoryRecordsBuilderTest.java
index 552b4e6..c3560f9 100644
--- a/clients/src/test/java/org/apache/kafka/common/record/MemoryRecordsBuilderTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/record/MemoryRecordsBuilderTest.java
@@ -597,7 +597,7 @@ public class MemoryRecordsBuilderTest {
}
@Test
- public void shouldThrowIllegalStateExceptionOnBuildWhenAborted() throws Exception {
+ public void shouldThrowIllegalStateExceptionOnBuildWhenAborted() {
expectExceptionWithZStd(compressionType, RecordBatch.MAGIC_VALUE_V0);
ByteBuffer buffer = ByteBuffer.allocate(128);
@@ -616,7 +616,7 @@ public class MemoryRecordsBuilderTest {
}
@Test
- public void shouldResetBufferToInitialPositionOnAbort() throws Exception {
+ public void shouldResetBufferToInitialPositionOnAbort() {
expectExceptionWithZStd(compressionType, RecordBatch.MAGIC_VALUE_V0);
ByteBuffer buffer = ByteBuffer.allocate(128);
@@ -631,7 +631,7 @@ public class MemoryRecordsBuilderTest {
}
@Test
- public void shouldThrowIllegalStateExceptionOnCloseWhenAborted() throws Exception {
+ public void shouldThrowIllegalStateExceptionOnCloseWhenAborted() {
expectExceptionWithZStd(compressionType, RecordBatch.MAGIC_VALUE_V0);
ByteBuffer buffer = ByteBuffer.allocate(128);
@@ -650,7 +650,7 @@ public class MemoryRecordsBuilderTest {
}
@Test
- public void shouldThrowIllegalStateExceptionOnAppendWhenAborted() throws Exception {
+ public void shouldThrowIllegalStateExceptionOnAppendWhenAborted() {
expectExceptionWithZStd(compressionType, RecordBatch.MAGIC_VALUE_V0);
ByteBuffer buffer = ByteBuffer.allocate(128);
diff --git a/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala b/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala
index 4a09ebe..66b81e5 100644
--- a/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala
+++ b/core/src/main/scala/kafka/server/ReplicaFetcherThread.scala
@@ -19,7 +19,6 @@ package kafka.server
import java.util.Optional
-import kafka.api
import kafka.api._
import kafka.cluster.BrokerEndPoint
import kafka.log.LogAppendInfo
diff --git a/core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala b/core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala
index efc7be0..4d5ef96 100755
--- a/core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala
+++ b/core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala
@@ -29,7 +29,6 @@ import kafka.utils.{KafkaScheduler, Logging}
import org.apache.kafka.common.utils.Time
import org.apache.zookeeper.AsyncCallback._
import org.apache.zookeeper.KeeperException.Code
-import org.apache.zookeeper.OpResult.{CreateResult, SetDataResult}
import org.apache.zookeeper.Watcher.Event.{EventType, KeeperState}
import org.apache.zookeeper.ZooKeeper.States
import org.apache.zookeeper.data.{ACL, Stat}
diff --git a/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala b/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
index 3bd86f5..f3e4294 100644
--- a/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
+++ b/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
@@ -17,13 +17,10 @@
package kafka.api
-import org.apache.commons.collections.CollectionUtils
import org.apache.kafka.common.record.RecordVersion
import org.junit.Test
import org.junit.Assert._
-import scala.collection.JavaConverters
-
class ApiVersionTest {
@Test
diff --git a/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala b/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
index 4b9f656..d6effad 100644
--- a/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
+++ b/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala
@@ -29,7 +29,7 @@ import kafka.server._
import kafka.utils.{CoreUtils, MockScheduler, MockTime, TestUtils}
import kafka.zk.KafkaZkClient
import org.apache.kafka.common.TopicPartition
-import org.apache.kafka.common.errors.{ApiException, LeaderNotAvailableException, OffsetNotAvailableException, ReplicaNotAvailableException}
+import org.apache.kafka.common.errors.{ApiException, OffsetNotAvailableException, ReplicaNotAvailableException}
import org.apache.kafka.common.metrics.Metrics
import org.apache.kafka.common.protocol.Errors
import org.apache.kafka.common.record.FileRecords.TimestampAndOffset
@@ -405,9 +405,6 @@ class PartitionTest {
val batch2 = TestUtils.records(records = List(new SimpleRecord("k3".getBytes, "v1".getBytes),
new SimpleRecord(20,"k4".getBytes, "v2".getBytes),
new SimpleRecord(21,"k5".getBytes, "v3".getBytes)))
- val batch3 = TestUtils.records(records = List(
- new SimpleRecord(30,"k6".getBytes, "v1".getBytes),
- new SimpleRecord(31,"k7".getBytes, "v2".getBytes)))
val partition = Partition(topicPartition, time, replicaManager)
assertTrue("Expected first makeLeader() to return 'leader changed'",
@@ -421,7 +418,7 @@ class PartitionTest {
val follower2Replica = partition.getReplica(follower2).get
// append records with initial leader epoch
- val lastOffsetOfFirstBatch = partition.appendRecordsToLeader(batch1, isFromClient = true).lastOffset
+ partition.appendRecordsToLeader(batch1, isFromClient = true)
partition.appendRecordsToLeader(batch2, isFromClient = true)
assertEquals("Expected leader's HW not move", leaderReplica.logStartOffset, leaderReplica.highWatermark.messageOffset)