kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject kafka git commit: MINOR: Fix error response handler for controlled shutdown v0
Date Fri, 04 Aug 2017 20:08:24 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 22611aca9 -> 70796c3ca


MINOR: Fix error response handler for controlled shutdown v0

Author: Jason Gustafson <jason@confluent.io>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #3627 from hachikuji/minor-fix-controlled-shutdown-error-response


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/70796c3c
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/70796c3c
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/70796c3c

Branch: refs/heads/trunk
Commit: 70796c3ca3306943e74d2ca260f3f28707481985
Parents: 22611ac
Author: Jason Gustafson <jason@confluent.io>
Authored: Fri Aug 4 13:08:12 2017 -0700
Committer: Jason Gustafson <jason@confluent.io>
Committed: Fri Aug 4 13:08:12 2017 -0700

----------------------------------------------------------------------
 .../apache/kafka/common/requests/ControlledShutdownRequest.java | 4 +---
 .../org/apache/kafka/common/requests/RequestResponseTest.java   | 5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/70796c3c/clients/src/main/java/org/apache/kafka/common/requests/ControlledShutdownRequest.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/ControlledShutdownRequest.java
b/clients/src/main/java/org/apache/kafka/common/requests/ControlledShutdownRequest.java
index fca2f63..1b49c6a 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/ControlledShutdownRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/ControlledShutdownRequest.java
@@ -53,7 +53,7 @@ public class ControlledShutdownRequest extends AbstractRequest {
             return bld.toString();
         }
     }
-    private int brokerId;
+    private final int brokerId;
 
     private ControlledShutdownRequest(int brokerId, short version) {
         super(version);
@@ -70,8 +70,6 @@ public class ControlledShutdownRequest extends AbstractRequest {
         short versionId = version();
         switch (versionId) {
             case 0:
-                throw new IllegalArgumentException("Version 0 is not supported. It is only
supported by " +
-                        "the Scala request class for controlled shutdown");
             case 1:
                 return new ControlledShutdownResponse(Errors.forException(e), Collections.<TopicPartition>emptySet());
             default:

http://git-wip-us.apache.org/repos/asf/kafka/blob/70796c3c/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
index 10e73b6..42d4205 100644
--- a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
@@ -87,6 +87,7 @@ public class RequestResponseTest {
         checkRequest(createControlledShutdownRequest());
         checkResponse(createControlledShutdownResponse(), 1);
         checkErrorResponse(createControlledShutdownRequest(), new UnknownServerException());
+        checkErrorResponse(createControlledShutdownRequest(0), new UnknownServerException());
         checkRequest(createFetchRequest(4));
         checkResponse(createFetchResponse(), 4);
         checkErrorResponse(createFetchRequest(4), new UnknownServerException());
@@ -762,6 +763,10 @@ public class RequestResponseTest {
         return new ControlledShutdownRequest.Builder(10).build();
     }
 
+    private ControlledShutdownRequest createControlledShutdownRequest(int version) {
+        return new ControlledShutdownRequest.Builder(10).build((short) version);
+    }
+
     private ControlledShutdownResponse createControlledShutdownResponse() {
         Set<TopicPartition> topicPartitions = Utils.mkSet(
                 new TopicPartition("test2", 5),


Mime
View raw message