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-2735: BrokerEndPoint should support uppercase hostnames.
Date Thu, 05 Nov 2015 21:25:17 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 490bbc911 -> bf2563e2f


KAFKA-2735: BrokerEndPoint should support uppercase hostnames.

Added support for uppercase hostnames in BrokerEndPoint. Added unit test
to cover this scenario.

Author: jholoman <jeff.holoman@gmail.com>

Reviewers: Grant Henke, Guozhang Wang

Closes #415 from jholoman/KAFKA-2735


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

Branch: refs/heads/trunk
Commit: bf2563e2f73881491ea94e83013e0ff319a25016
Parents: 490bbc9
Author: Jeff Holoman <jeff.holoman@gmail.com>
Authored: Thu Nov 5 13:31:01 2015 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Nov 5 13:31:01 2015 -0800

----------------------------------------------------------------------
 core/src/main/scala/kafka/cluster/BrokerEndPoint.scala          | 2 +-
 core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/bf2563e2/core/src/main/scala/kafka/cluster/BrokerEndPoint.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/cluster/BrokerEndPoint.scala b/core/src/main/scala/kafka/cluster/BrokerEndPoint.scala
index 75efd77..9ae6fce 100644
--- a/core/src/main/scala/kafka/cluster/BrokerEndPoint.scala
+++ b/core/src/main/scala/kafka/cluster/BrokerEndPoint.scala
@@ -24,7 +24,7 @@ import org.apache.kafka.common.utils.Utils._
 
 object BrokerEndPoint {
 
-  private val uriParseExp = """\[?([0-9a-z\-.:]*)\]?:([0-9]+)""".r
+  private val uriParseExp = """\[?([0-9a-zA-Z\-.:]*)\]?:([0-9]+)""".r
 
   /**
    * BrokerEndPoint URI is host:port or [ipv6_host]:port

http://git-wip-us.apache.org/repos/asf/kafka/blob/bf2563e2/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala b/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
index 2d3a9c3..7b8bf4b 100644
--- a/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
+++ b/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
@@ -98,6 +98,11 @@ class BrokerEndPointTest extends Logging {
     endpoint = BrokerEndPoint.createBrokerEndPoint(1, connectionString)
     assert(endpoint.host == "::1")
     assert(endpoint.port == 9092)
+    // add test for uppercase in hostname
+    connectionString = "MyHostname:9092"
+    endpoint = BrokerEndPoint.createBrokerEndPoint(1, connectionString)
+    assert(endpoint.host == "MyHostname")
+    assert(endpoint.port == 9092)
   }
 
   @Test


Mime
View raw message