[ 
https://issues.apache.org/jira/browse/KAFKA-1618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14142168#comment-14142168
 ] 

Neha Narkhede commented on KAFKA-1618:
--------------------------------------

Thanks for the patch, [~balaji.sesha...@dish.com]. Few review comments -
ConsoleProducer
1. The variable regex is not used on line 222. 
2. In the validate() API, shouldn't the regex be val regex = new 
Regex(":[0-9].*") instead?
3. Since the PortValidator is common to all tools, it is worth moving the 
validateAndDie to a new class ToolsUtils. I'm sure we can refactor the tools to 
move some commonly usable APIs there.
4. Let's rename validateAndDie to validatePortOrDie. When you create 
ToolsUtils, let's only move validatePortOrDie there and move the logic from 
validate to validatePortOrDie. validate is only used by that API.

Throughout the patch-
1. Please remove the whitespace introduced for the imports. Let's keep things 
consistent across the codebase
2. Please get rid of the whitespace between if and (. Also not consistent with 
the rest of the code. 

> Exception thrown when running console producer with no port number for the 
> broker
> ---------------------------------------------------------------------------------
>
>                 Key: KAFKA-1618
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1618
>             Project: Kafka
>          Issue Type: Improvement
>    Affects Versions: 0.8.1.1
>            Reporter: Gwen Shapira
>            Assignee: Balaji Seshadri
>              Labels: newbie
>             Fix For: 0.8.2
>
>         Attachments: KAFKA-1618-ALL.patch, KAFKA-1618.patch
>
>
> When running console producer with just "localhost" as the broker list, I get 
> ArrayIndexOutOfBounds exception.
> I expect either a clearer error about arguments or for the producer to 
> "guess" a default port.
> [root@shapira-1 bin]# ./kafka-console-producer.sh  --topic rufus1 
> --broker-list localhost
> java.lang.ArrayIndexOutOfBoundsException: 1
>       at 
> kafka.client.ClientUtils$$anonfun$parseBrokerList$1.apply(ClientUtils.scala:102)
>       at 
> kafka.client.ClientUtils$$anonfun$parseBrokerList$1.apply(ClientUtils.scala:97)
>       at 
> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
>       at 
> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
>       at 
> scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
>       at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
>       at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
>       at scala.collection.AbstractTraversable.map(Traversable.scala:105)
>       at kafka.client.ClientUtils$.parseBrokerList(ClientUtils.scala:97)
>       at 
> kafka.producer.BrokerPartitionInfo.<init>(BrokerPartitionInfo.scala:32)
>       at 
> kafka.producer.async.DefaultEventHandler.<init>(DefaultEventHandler.scala:41)
>       at kafka.producer.Producer.<init>(Producer.scala:59)
>       at kafka.producer.ConsoleProducer$.main(ConsoleProducer.scala:158)
>       at kafka.producer.ConsoleProducer.main(ConsoleProducer.scala)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to