kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject git commit: kafka-1198; NullPointerException in describe topic; patched by Guozhang Wang; reviewed by Jun Rao
Date Fri, 03 Jan 2014 20:18:19 GMT
Updated Branches:
  refs/heads/trunk 3f88be631 -> 15f3c8417


kafka-1198; NullPointerException in describe topic; patched by Guozhang Wang; reviewed by
Jun Rao


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

Branch: refs/heads/trunk
Commit: 15f3c8417e07e6bc6cbe0c5991f5641396c61b24
Parents: 3f88be6
Author: Guozhang Wang <guwang@linkedin.com>
Authored: Fri Jan 3 12:21:49 2014 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Fri Jan 3 12:21:49 2014 -0800

----------------------------------------------------------------------
 core/src/main/scala/kafka/admin/TopicCommand.scala | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/15f3c841/core/src/main/scala/kafka/admin/TopicCommand.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/admin/TopicCommand.scala b/core/src/main/scala/kafka/admin/TopicCommand.scala
index 083fd63..842c110 100644
--- a/core/src/main/scala/kafka/admin/TopicCommand.scala
+++ b/core/src/main/scala/kafka/admin/TopicCommand.scala
@@ -42,6 +42,7 @@ object TopicCommand {
     }
       
     CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.zkConnectOpt)
+    if (!opts.options.has(opts.listOpt)) CommandLineUtils.checkRequiredArgs(opts.parser,
opts.options, opts.topicOpt)
     
     val zkClient = new ZkClient(opts.options.valueOf(opts.zkConnectOpt), 30000, 30000, ZKStringSerializer)
 
@@ -57,7 +58,9 @@ object TopicCommand {
       else if(opts.options.has(opts.describeOpt))
         describeTopic(zkClient, opts)
     } catch {
-      case e => println("Error while executing topic command", e)
+      case e =>
+        println("Error while executing topic command " + e.getMessage)
+        println(Utils.stackTrace(e))
     } finally {
       zkClient.close()
     }
@@ -71,7 +74,6 @@ object TopicCommand {
   }
 
   def createTopic(zkClient: ZkClient, opts: TopicCommandOptions) {
-    CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt)
     val topic = opts.options.valueOf(opts.topicOpt)
     val configs = parseTopicConfigsToBeAdded(opts)
     if (opts.options.has(opts.replicaAssignmentOpt)) {
@@ -87,7 +89,6 @@ object TopicCommand {
   }
 
   def alterTopic(zkClient: ZkClient, opts: TopicCommandOptions) {
-    CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt)
     val topics = getTopics(zkClient, opts)
     topics.foreach { topic =>
       if(opts.options.has(opts.configOpt) || opts.options.has(opts.deleteConfigOpt)) {
@@ -114,7 +115,6 @@ object TopicCommand {
   }
   
   def deleteTopic(zkClient: ZkClient, opts: TopicCommandOptions) {
-    CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt)
     val topics = getTopics(zkClient, opts)
     topics.foreach { topic =>
       AdminUtils.deleteTopic(zkClient, topic)
@@ -141,7 +141,7 @@ object TopicCommand {
   }
   
   def describeTopic(zkClient: ZkClient, opts: TopicCommandOptions) {
-    var topics = getTopics(zkClient, opts)
+    val topics = getTopics(zkClient, opts)
     val reportUnderReplicatedPartitions = if (opts.options.has(opts.reportUnderReplicatedPartitionsOpt))
true else false
     val reportUnavailablePartitions = if (opts.options.has(opts.reportUnavailablePartitionsOpt))
true else false
     val liveBrokers = ZkUtils.getAllBrokersInCluster(zkClient).map(_.id).toSet


Mime
View raw message