You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2015/06/17 00:25:22 UTC
kafka git commit: kafka-2272;
listeners endpoint parsing fails if the hostname has capital letter;
patched by Sriharsha Chintalapani; reviewed by Jun Rao
Repository: kafka
Updated Branches:
refs/heads/trunk 395716ebf -> 28ecea421
kafka-2272; listeners endpoint parsing fails if the hostname has capital letter; patched by Sriharsha Chintalapani; 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/28ecea42
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/28ecea42
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/28ecea42
Branch: refs/heads/trunk
Commit: 28ecea421794d0c9a1c4f95375ccd1a6dfd8f365
Parents: 395716e
Author: Sriharsha Chintalapani <sc...@hortonworks.com>
Authored: Tue Jun 16 15:25:16 2015 -0700
Committer: Jun Rao <ju...@gmail.com>
Committed: Tue Jun 16 15:25:16 2015 -0700
----------------------------------------------------------------------
core/src/main/scala/kafka/cluster/EndPoint.scala | 2 +-
.../src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/28ecea42/core/src/main/scala/kafka/cluster/EndPoint.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/cluster/EndPoint.scala b/core/src/main/scala/kafka/cluster/EndPoint.scala
index e9008e6..76997b5 100644
--- a/core/src/main/scala/kafka/cluster/EndPoint.scala
+++ b/core/src/main/scala/kafka/cluster/EndPoint.scala
@@ -42,7 +42,7 @@ object EndPoint {
* @return
*/
def createEndPoint(connectionString: String): EndPoint = {
- val uriParseExp = """^(.*)://\[?([0-9a-z\-.:]*)\]?:(-?[0-9]+)""".r
+ val uriParseExp = """^(.*)://\[?([0-9a-zA-Z\-.:]*)\]?:(-?[0-9]+)""".r
connectionString match {
case uriParseExp(protocol, "", port) => new EndPoint(null, port.toInt, SecurityProtocol.valueOf(protocol))
case uriParseExp(protocol, host, port) => new EndPoint(host, port.toInt, SecurityProtocol.valueOf(protocol))
http://git-wip-us.apache.org/repos/asf/kafka/blob/28ecea42/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 bb2506c..abe511f 100644
--- a/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
+++ b/core/src/test/scala/unit/kafka/cluster/BrokerEndPointTest.scala
@@ -120,5 +120,11 @@ class BrokerEndPointTest extends JUnit3Suite with Logging {
assert(endpoint.host == "::1")
assert(endpoint.port == 9092)
assert(endpoint.connectionString == "PLAINTEXT://[::1]:9092")
+ // test hostname
+ connectionString = "PLAINTEXT://MyHostname:9092"
+ endpoint = EndPoint.createEndPoint(connectionString)
+ assert(endpoint.host == "MyHostname")
+ assert(endpoint.port == 9092)
+ assert(endpoint.connectionString == "PLAINTEXT://MyHostname:9092")
}
}