This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch bdbje in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git
The following commit(s) were added to refs/heads/bdbje by this push: new 7bf75a7 [bdbje] support resolve IPV6 address (#11) 7bf75a7 is described below commit 7bf75a7475fab88711ba01ab4a549c70a1c13269 Author: zhengshengjun <zhengsheng...@apache.org> AuthorDate: Wed Nov 16 09:47:49 2022 +0800 [bdbje] support resolve IPV6 address (#11) --- src/main/java/com/sleepycat/je/rep/ReplicationConfig.java | 4 ++-- src/main/java/com/sleepycat/je/rep/arbiter/impl/ArbiterImpl.java | 4 ++-- src/main/java/com/sleepycat/je/rep/impl/RepImpl.java | 4 ++-- src/main/java/com/sleepycat/je/rep/impl/RepParams.java | 7 ++++--- src/main/java/com/sleepycat/je/rep/monitor/MonitorConfig.java | 4 ++-- src/main/java/com/sleepycat/je/rep/util/DbGroupAdmin.java | 2 +- src/main/java/com/sleepycat/je/rep/utilint/HostPortPair.java | 6 +++--- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/sleepycat/je/rep/ReplicationConfig.java b/src/main/java/com/sleepycat/je/rep/ReplicationConfig.java index a379865..cfd6984 100644 --- a/src/main/java/com/sleepycat/je/rep/ReplicationConfig.java +++ b/src/main/java/com/sleepycat/je/rep/ReplicationConfig.java @@ -1768,7 +1768,7 @@ public class ReplicationConfig extends ReplicationMutableConfig public String getNodeHostname() { String hostAndPort = DbConfigManager.getVal(props, RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; @@ -1782,7 +1782,7 @@ public class ReplicationConfig extends ReplicationMutableConfig public int getNodePort() { String hostAndPort = DbConfigManager.getVal(props, RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); String portString = (colonToken >= 0) ? hostAndPort.substring(colonToken + 1) : diff --git a/src/main/java/com/sleepycat/je/rep/arbiter/impl/ArbiterImpl.java b/src/main/java/com/sleepycat/je/rep/arbiter/impl/ArbiterImpl.java index e6f559b..626da81 100644 --- a/src/main/java/com/sleepycat/je/rep/arbiter/impl/ArbiterImpl.java +++ b/src/main/java/com/sleepycat/je/rep/arbiter/impl/ArbiterImpl.java @@ -749,7 +749,7 @@ public class ArbiterImpl extends StoppableThread { public String getHostName() { String hostAndPort = repImpl.getConfigManager().get(RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; @@ -764,7 +764,7 @@ public class ArbiterImpl extends StoppableThread { String hostAndPort = repImpl.getConfigManager().get(RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? Integer.parseInt(hostAndPort.substring(colonToken + 1)) : diff --git a/src/main/java/com/sleepycat/je/rep/impl/RepImpl.java b/src/main/java/com/sleepycat/je/rep/impl/RepImpl.java index 934ce3b..a37a93d 100644 --- a/src/main/java/com/sleepycat/je/rep/impl/RepImpl.java +++ b/src/main/java/com/sleepycat/je/rep/impl/RepImpl.java @@ -1766,7 +1766,7 @@ public class RepImpl */ public String getHostName() { String hostAndPort = configManager.get(RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; @@ -1807,7 +1807,7 @@ public class RepImpl */ public int getPort() { String hostAndPort = configManager.get(RepParams.NODE_HOST_PORT); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? Integer.parseInt(hostAndPort.substring(colonToken + 1)) : configManager.getInt(RepParams.DEFAULT_PORT); diff --git a/src/main/java/com/sleepycat/je/rep/impl/RepParams.java b/src/main/java/com/sleepycat/je/rep/impl/RepParams.java index 8c7b926..768f4ea 100644 --- a/src/main/java/com/sleepycat/je/rep/impl/RepParams.java +++ b/src/main/java/com/sleepycat/je/rep/impl/RepParams.java @@ -119,7 +119,8 @@ public class RepParams { if (Character.isLetterOrDigit(c) || c == '-' || c == '_' || - c == '.') { + c == '.' || + c == ':' ) { return true; } return false; @@ -407,7 +408,7 @@ public class RepParams { throw new IllegalArgumentException ("The value cannot be null or zero length: " + name); } - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); String hostName = (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; @@ -1072,7 +1073,7 @@ public class RepParams { boolean skipHostnameResolution) throws IllegalArgumentException { - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); String hostName = (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; diff --git a/src/main/java/com/sleepycat/je/rep/monitor/MonitorConfig.java b/src/main/java/com/sleepycat/je/rep/monitor/MonitorConfig.java index 0b8beae..0a74a2c 100644 --- a/src/main/java/com/sleepycat/je/rep/monitor/MonitorConfig.java +++ b/src/main/java/com/sleepycat/je/rep/monitor/MonitorConfig.java @@ -268,7 +268,7 @@ public class MonitorConfig implements Cloneable { */ public String getNodeHostname() { String hostAndPort = getNodeHostPort(); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); return (colonToken >= 0) ? hostAndPort.substring(0, colonToken) : hostAndPort; @@ -281,7 +281,7 @@ public class MonitorConfig implements Cloneable { */ public int getNodePort() { String hostAndPort = getNodeHostPort(); - int colonToken = hostAndPort.indexOf(":"); + int colonToken = hostAndPort.lastIndexOf(":"); String portString = (colonToken >= 0) ? hostAndPort.substring(colonToken + 1) : diff --git a/src/main/java/com/sleepycat/je/rep/util/DbGroupAdmin.java b/src/main/java/com/sleepycat/je/rep/util/DbGroupAdmin.java index 4b6a5b8..b9e26c3 100644 --- a/src/main/java/com/sleepycat/je/rep/util/DbGroupAdmin.java +++ b/src/main/java/com/sleepycat/je/rep/util/DbGroupAdmin.java @@ -186,7 +186,7 @@ public class DbGroupAdmin { if (argc < nArgs) { String hostPort = argv[argc++]; - int index = hostPort.indexOf(":"); + int index = hostPort.lastIndexOf(":"); if (index < 0) { printUsage("Host port pair format must be " + "<host name>:<port number>"); diff --git a/src/main/java/com/sleepycat/je/rep/utilint/HostPortPair.java b/src/main/java/com/sleepycat/je/rep/utilint/HostPortPair.java index 362ec70..1230cb8 100644 --- a/src/main/java/com/sleepycat/je/rep/utilint/HostPortPair.java +++ b/src/main/java/com/sleepycat/je/rep/utilint/HostPortPair.java @@ -42,7 +42,7 @@ public class HostPortPair { throw new IllegalArgumentException ("Host and port pair was missing"); } - int portStartIndex = hostPortPair.indexOf(SEPARATOR); + int portStartIndex = hostPortPair.lastIndexOf(SEPARATOR); String hostName = hostPortPair; int port = -1; if (portStartIndex < 0) { @@ -84,7 +84,7 @@ public class HostPortPair { * Parses and returns the hostname string of a hostport pair */ public static String getHostname(String hostPortPair) { - int portStartIndex = hostPortPair.indexOf(SEPARATOR); + int portStartIndex = hostPortPair.lastIndexOf(SEPARATOR); return (portStartIndex < 0) ? hostPortPair : hostPortPair.substring(0, portStartIndex); @@ -94,7 +94,7 @@ public class HostPortPair { * Parses and returns the port of a hostport pair */ public static int getPort(String hostPortPair) { - int portStartIndex = hostPortPair.indexOf(SEPARATOR); + int portStartIndex = hostPortPair.lastIndexOf(SEPARATOR); return Integer.parseInt((portStartIndex < 0) ? RepParams.DEFAULT_PORT.getDefault() : hostPortPair.substring(portStartIndex+1)); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org