kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: KAFKA-3002; Allow uppercase letters in hostnames
Date Thu, 24 Dec 2015 04:56:19 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 83d4c359b -> ea7335690


KAFKA-3002; Allow uppercase letters in hostnames

Make available to specify hostname with Uppercase at broker list

Author: Sasaki Toru <sasakitoa@nttdata.co.jp>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Grant Henke <granthenke@gmail.com>,
Ewen Cheslack-Postava <ewen@confluent.io>

Closes #685 from sasakitoa/hostname_uppercase


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

Branch: refs/heads/trunk
Commit: ea73356905ff4663d0d085c46b348fa4e9b9568d
Parents: 83d4c35
Author: Sasaki Toru <sasakitoa@nttdata.co.jp>
Authored: Wed Dec 23 20:55:01 2015 -0800
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Wed Dec 23 20:55:01 2015 -0800

----------------------------------------------------------------------
 clients/src/main/java/org/apache/kafka/common/utils/Utils.java   | 2 +-
 .../src/test/java/org/apache/kafka/common/utils/UtilsTest.java   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/ea733569/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
index ac6e132..e725722 100755
--- a/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
+++ b/clients/src/main/java/org/apache/kafka/common/utils/Utils.java
@@ -47,7 +47,7 @@ public class Utils {
 
     // This matches URIs of formats: host:port and protocol:\\host:port
     // IPv6 is supported with [ip] pattern
-    private static final Pattern HOST_PORT_PATTERN = Pattern.compile(".*?\\[?([0-9a-z\\-.:]*)\\]?:([0-9]+)");
+    private static final Pattern HOST_PORT_PATTERN = Pattern.compile(".*?\\[?([0-9a-zA-Z\\-.:]*)\\]?:([0-9]+)");
 
     public static final String NL = System.getProperty("line.separator");
 

http://git-wip-us.apache.org/repos/asf/kafka/blob/ea733569/clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java b/clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java
index 04dc3d2..8ccc647 100755
--- a/clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/utils/UtilsTest.java
@@ -33,16 +33,20 @@ public class UtilsTest {
     public void testGetHost() {
         assertEquals("127.0.0.1", getHost("127.0.0.1:8000"));
         assertEquals("mydomain.com", getHost("PLAINTEXT://mydomain.com:8080"));
+        assertEquals("MyDomain.com", getHost("PLAINTEXT://MyDomain.com:8080"));
         assertEquals("::1", getHost("[::1]:1234"));
         assertEquals("2001:db8:85a3:8d3:1319:8a2e:370:7348", getHost("PLAINTEXT://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:5678"));
+        assertEquals("2001:DB8:85A3:8D3:1319:8A2E:370:7348", getHost("PLAINTEXT://[2001:DB8:85A3:8D3:1319:8A2E:370:7348]:5678"));
     }
 
     @Test
     public void testGetPort() {
         assertEquals(8000, getPort("127.0.0.1:8000").intValue());
         assertEquals(8080, getPort("mydomain.com:8080").intValue());
+        assertEquals(8080, getPort("MyDomain.com:8080").intValue());
         assertEquals(1234, getPort("[::1]:1234").intValue());
         assertEquals(5678, getPort("[2001:db8:85a3:8d3:1319:8a2e:370:7348]:5678").intValue());
+        assertEquals(5678, getPort("[2001:DB8:85A3:8D3:1319:8A2E:370:7348]:5678").intValue());
     }
 
     @Test


Mime
View raw message