未验证 提交 3efcd85d 编写于 作者: H Heng Du 提交者: GitHub

Merge pull request #3122 from panzhi33/master

[ISSUE #3123]fix namesrv endpoint
...@@ -178,7 +178,7 @@ public class ClientConfig { ...@@ -178,7 +178,7 @@ public class ClientConfig {
} }
public String getNamesrvAddr() { public String getNamesrvAddr() {
if (StringUtils.isNotEmpty(namesrvAddr) && NameServerAddressUtils.validateInstanceEndpoint(namesrvAddr.trim())) { if (StringUtils.isNotEmpty(namesrvAddr) && NameServerAddressUtils.NAMESRV_ENDPOINT_PATTERN.matcher(namesrvAddr.trim()).matches()) {
return NameServerAddressUtils.getNameSrvAddrFromNamesrvEndpoint(namesrvAddr); return NameServerAddressUtils.getNameSrvAddrFromNamesrvEndpoint(namesrvAddr);
} }
return namesrvAddr; return namesrvAddr;
......
...@@ -20,6 +20,7 @@ public class NameServerAddressUtils { ...@@ -20,6 +20,7 @@ public class NameServerAddressUtils {
public static final String INSTANCE_PREFIX = "MQ_INST_"; public static final String INSTANCE_PREFIX = "MQ_INST_";
public static final String INSTANCE_REGEX = INSTANCE_PREFIX + "\\w+_\\w+"; public static final String INSTANCE_REGEX = INSTANCE_PREFIX + "\\w+_\\w+";
public static final String ENDPOINT_PREFIX = "(\\w+://|)"; public static final String ENDPOINT_PREFIX = "(\\w+://|)";
public static final Pattern NAMESRV_ENDPOINT_PATTERN = Pattern.compile("^http://.*");
public static final Pattern INST_ENDPOINT_PATTERN = Pattern.compile("^" + ENDPOINT_PREFIX + INSTANCE_REGEX + "\\..*"); public static final Pattern INST_ENDPOINT_PATTERN = Pattern.compile("^" + ENDPOINT_PREFIX + INSTANCE_REGEX + "\\..*");
public static String getNameServerAddresses() { public static String getNameServerAddresses() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册