kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nehanarkh...@apache.org
Subject git commit: KAFKA-1086 Improve GetOffsetShell to find metadata automatically; reviewed by Jun Rao and Joel Koshy
Date Wed, 16 Oct 2013 23:37:47 GMT
Updated Branches:
  refs/heads/trunk d5dfa2859 -> b448d4e07


KAFKA-1086 Improve GetOffsetShell to find metadata automatically; reviewed by Jun Rao and
Joel Koshy


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

Branch: refs/heads/trunk
Commit: b448d4e075f0f138530e6cfc0634f4035c8d1878
Parents: d5dfa28
Author: Neha Narkhede <neha.narkhede@gmail.com>
Authored: Wed Oct 16 16:36:53 2013 -0700
Committer: Neha Narkhede <neha.narkhede@gmail.com>
Committed: Wed Oct 16 16:37:03 2013 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/tools/GetOffsetShell.scala | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/b448d4e0/core/src/main/scala/kafka/tools/GetOffsetShell.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/GetOffsetShell.scala b/core/src/main/scala/kafka/tools/GetOffsetShell.scala
index 4d1457f..fba652e 100644
--- a/core/src/main/scala/kafka/tools/GetOffsetShell.scala
+++ b/core/src/main/scala/kafka/tools/GetOffsetShell.scala
@@ -20,10 +20,10 @@ package kafka.tools
 
 import kafka.consumer._
 import joptsimple._
-import java.net.URI
 import kafka.api.{PartitionOffsetRequestInfo, OffsetRequest}
 import kafka.common.TopicAndPartition
 import kafka.client.ClientUtils
+import kafka.utils.CommandLineUtils
 
 
 object GetOffsetShell {
@@ -60,13 +60,7 @@ object GetOffsetShell {
 
     val options = parser.parse(args : _*)
 
-    for(arg <- List(brokerListOpt, topicOpt, timeOpt)) {
-      if(!options.has(arg)) {
-        System.err.println("Missing required argument \"" + arg + "\"")
-        parser.printHelpOn(System.err)
-        System.exit(1)
-      }
-    }
+    CommandLineUtils.checkRequiredArgs(parser, options, brokerListOpt, topicOpt, timeOpt)
 
     val clientId = "GetOffsetShell"
     val metadataTargetBrokers = ClientUtils.parseBrokerList(options.valueOf(brokerListOpt))
@@ -86,7 +80,7 @@ object GetOffsetShell {
       if(partitionList == "") {
         topicsMetadata.head.partitionsMetadata.map(_.partitionId)
       } else {
-        partitionList.mkString(",").map(_.toInt)
+        partitionList.split(",").map(_.toInt).toSeq
       }
     partitions.foreach { partitionId =>
       val partitionMetadataOpt = topicsMetadata.head.partitionsMetadata.find(_.partitionId
== partitionId)


Mime
View raw message