kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-2755: Suspicious reference forwarding cause NPE on handleDescribeGroup.
Date Thu, 05 Nov 2015 21:11:17 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 7eee11451 -> 490bbc911


KAFKA-2755: Suspicious reference forwarding cause NPE on handleDescribeGroup.

…xistent consumer group

Author: Ashish Singh <asingh@cloudera.com>

Reviewers: Guozhang Wang

Closes #435 from SinghAsDev/KAFKA-2755


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

Branch: refs/heads/trunk
Commit: 490bbc91183d1468a164d80f826317f137026684
Parents: 7eee114
Author: Ashish Singh <asingh@cloudera.com>
Authored: Thu Nov 5 13:16:58 2015 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Nov 5 13:16:58 2015 -0800

----------------------------------------------------------------------
 .../main/scala/kafka/coordinator/GroupCoordinator.scala  |  6 +++---
 .../scala/integration/kafka/api/AdminClientTest.scala    | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/490bbc91/core/src/main/scala/kafka/coordinator/GroupCoordinator.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/coordinator/GroupCoordinator.scala b/core/src/main/scala/kafka/coordinator/GroupCoordinator.scala
index 2015371..900830f 100644
--- a/core/src/main/scala/kafka/coordinator/GroupCoordinator.scala
+++ b/core/src/main/scala/kafka/coordinator/GroupCoordinator.scala
@@ -662,13 +662,13 @@ class GroupCoordinator(val brokerId: Int,
 
 object GroupCoordinator {
 
-  val EmptyGroup = GroupSummary(NoState, NoProtocolType, NoProtocol, NoMembers)
-  val DeadGroup = GroupSummary(Dead.toString, NoProtocolType, NoProtocol, NoMembers)
-  val NoMembers = List[MemberSummary]()
   val NoState = ""
   val NoProtocolType = ""
   val NoProtocol = ""
   val NoLeader = ""
+  val NoMembers = List[MemberSummary]()
+  val EmptyGroup = GroupSummary(NoState, NoProtocolType, NoProtocol, NoMembers)
+  val DeadGroup = GroupSummary(Dead.toString, NoProtocolType, NoProtocol, NoMembers)
 
   // TODO: we store both group metadata and offset data here despite the topic name being
offsets only
   val GroupMetadataTopicName = "__consumer_offsets"

http://git-wip-us.apache.org/repos/asf/kafka/blob/490bbc91/core/src/test/scala/integration/kafka/api/AdminClientTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/integration/kafka/api/AdminClientTest.scala b/core/src/test/scala/integration/kafka/api/AdminClientTest.scala
index 97b49dd..7d529ec 100644
--- a/core/src/test/scala/integration/kafka/api/AdminClientTest.scala
+++ b/core/src/test/scala/integration/kafka/api/AdminClientTest.scala
@@ -111,4 +111,15 @@ class AdminClientTest extends IntegrationTestHarness with Logging {
       assertEquals(Set(tp, tp2), partitions.toSet)
   }
 
+  @Test
+  def testDescribeConsumerGroupForNonExistentGroup() {
+    val nonExistentGroup = "non" + groupId
+    try {
+      client.describeConsumerGroup(nonExistentGroup)
+      fail("Should have failed for non existent group.")
+    } catch {
+      case ex: IllegalArgumentException => // Pass
+      case _: Throwable => fail("Should have failed for non existent group with IllegalArgumentException.")
+    }
+  }
 }


Mime
View raw message