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

ASF GitHub Bot commented on KAFKA-3622:
---------------------------------------

GitHub user peterableda opened a pull request:

    https://github.com/apache/kafka/pull/1269

    KAFKA-3622: Use descriptive error message if port number is missing from url

    A new exception is thrown in *parseAndValidateAddresses* method when the 
port number is missing from the url. 
    
    The change was not trivial as the previous implementation of *getHost* and 
*getPort* both returned *null* if ex. the port number was missing from the url.
    To fix this behaviour I added some extra test cases and examples to the 
unit tests with the expected behaviour and modified the *HOST_PORT_PATTERN* 
regex and the above mentioned methods.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/peterableda/kafka KAFKA-3622

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/1269.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1269
    
----
commit 16f58fb973497fd8b947e6a2d0fcdd2d423693d9
Author: Peter Ableda <peter.abl...@cloudera.com>
Date:   2016-04-26T10:25:08Z

    Fix getHost and getPort methods to parse URLs without 
    port numbers

commit 73181f4bd52f4dbf2e83aee3472a3666d74b969c
Author: Peter Ableda <peter.abl...@cloudera.com>
Date:   2016-04-26T10:34:34Z

    Add specific message in case of missing port from url

----


> Kafka throws undescriptive error message if port is missing from url
> --------------------------------------------------------------------
>
>                 Key: KAFKA-3622
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3622
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Peter Ableda
>            Priority: Minor
>
> When I try to set up MirrorMaker with *bootstrap.servers* missing the port 
> numbers from the URLs the above error is thrown:
> {code}
> Caused by: org.apache.kafka.common.config.ConfigException: Invalid url in 
> bootstrap.servers: host-1.com
>         at 
> org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:44)
>         at 
> org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:574)
>         ... 12 more
> {code}
> This message doesn't suggest that the port number is needed in the 
> *bootstrap.servers* configuration which causes confusion for users who try to 
> set this up for the first time.
> The above *ConfigException* message should be shown:  
> {code}
> Missing port in bootstrap.servers: 127.0.0.1
> {code}



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

Reply via email to