You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2017/04/15 20:29:13 UTC

[1/3] storm git commit: STORM-2475: Fix parsing of host:port to deal with IPv6 addresses

Repository: storm
Updated Branches:
  refs/heads/master 487a246cb -> c38d7950a


STORM-2475:  Fix parsing of host:port to deal with IPv6 addresses


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

Branch: refs/heads/master
Commit: 2823682d1de37676b76011535fdbe3dd311208cd
Parents: 4a3a238
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Thu Apr 13 19:34:11 2017 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Thu Apr 13 19:34:11 2017 -0500

----------------------------------------------------------------------
 .../jvm/org/apache/storm/nimbus/NimbusInfo.java | 25 +++++++++++---------
 1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/2823682d/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java
----------------------------------------------------------------------
diff --git a/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java b/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java
index 0693f65..2b5033e 100644
--- a/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java
+++ b/storm-client/src/jvm/org/apache/storm/nimbus/NimbusInfo.java
@@ -17,38 +17,41 @@
  */
 package org.apache.storm.nimbus;
 
-import org.apache.storm.Config;
-import org.apache.storm.utils.ObjectReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.Serializable;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.storm.Config;
+import org.apache.storm.utils.ObjectReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NimbusInfo implements Serializable {
     private static final long serialVersionUID = 2161446155116099333L;
     private static final Logger LOG = LoggerFactory.getLogger(NimbusInfo.class);
-    private static final String DELIM = ":";
 
     private String host;
     private int port;
     private boolean isLeader;
 
     public NimbusInfo(String host, int port, boolean isLeader) {
+        if (host == null) throw new NullPointerException("Host cannot be null");
+        if (port <= 0) throw new IllegalArgumentException("Port must be positive");
         this.host = host;
         this.port = port;
         this.isLeader = isLeader;
     }
 
+    private static final Pattern HOST_PORT_PATTERN = Pattern.compile("^(.*):([0-9]+)$");
     public static NimbusInfo parse(String nimbusInfo) {
-        String[] hostAndPort = nimbusInfo.split(DELIM);
-        if(hostAndPort != null && hostAndPort.length == 2) {
-            return new NimbusInfo(hostAndPort[0], Integer.parseInt(hostAndPort[1]), false);
-        } else {
+        Matcher m = HOST_PORT_PATTERN.matcher(nimbusInfo);
+        if (!m.matches()) {
             throw new RuntimeException("nimbusInfo should have format of host:port, invalid string " + nimbusInfo);
         }
+        return new NimbusInfo(m.group(1), Integer.valueOf(m.group(2)), false);
     }
 
     public static NimbusInfo fromConf(Map<String, Object> conf) {
@@ -70,7 +73,7 @@ public class NimbusInfo implements Serializable {
     }
 
     public String toHostPortString() {
-        return String.format("%s%s%s",host,DELIM,port);
+        return String.format("%s:%s",host,port);
     }
 
     public boolean isLeader() {


[3/3] storm git commit: added STORM-2475 to changelog

Posted by bo...@apache.org.
added STORM-2475 to changelog


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

Branch: refs/heads/master
Commit: c38d7950a347e906a8ebe7b2889c65c6e8e8c936
Parents: edf4db0
Author: Robert Evans <ev...@yahoo-inc.com>
Authored: Sat Apr 15 15:22:11 2017 -0500
Committer: Robert Evans <ev...@yahoo-inc.com>
Committed: Sat Apr 15 15:22:11 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/c38d7950/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 948a0ba..63a4aa1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 \ufeff## 2.0.0
+ * STORM-2475: Fix parsing of host:port to deal with IPv6 addresses
  * STORM-832: Allow config validation to be used by plugins/etc.
  * STORM-2471: Add metric for thread count
  * STORM-1114: Race condition in trident zookeeper zk-node create/delete


[2/3] storm git commit: Merge branch 'STORM-2475' of https://github.com/revans2/incubator-storm into STORM-2475

Posted by bo...@apache.org.
Merge branch 'STORM-2475' of https://github.com/revans2/incubator-storm into STORM-2475

STORM-2475: Fix parsing of host:port to deal with IPv6 addresses


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

Branch: refs/heads/master
Commit: edf4db0130c02b60c419a028051051202bea28ed
Parents: 487a246 2823682
Author: Robert Evans <ev...@yahoo-inc.com>
Authored: Sat Apr 15 15:21:38 2017 -0500
Committer: Robert Evans <ev...@yahoo-inc.com>
Committed: Sat Apr 15 15:21:38 2017 -0500

----------------------------------------------------------------------
 .../jvm/org/apache/storm/nimbus/NimbusInfo.java | 25 +++++++++++---------
 1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------