rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duhengfore...@apache.org
Subject [rocketmq] branch develop updated: fix namesrv endpoint
Date Tue, 13 Jul 2021 01:01:43 GMT
This is an automated email from the ASF dual-hosted git repository.

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new f4b3d4f  fix namesrv endpoint
     new 3efcd85  Merge pull request #3122 from panzhi33/master
f4b3d4f is described below

commit f4b3d4f8350b594609640579c983774b296e6290
Author: panzhi33 <wb-pz502261@alibaba-inc.com>
AuthorDate: Fri Jul 2 17:12:51 2021 +0800

    fix namesrv endpoint
---
 client/src/main/java/org/apache/rocketmq/client/ClientConfig.java       | 2 +-
 .../java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
index 3ab214b..beeeb2f 100644
--- a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java
@@ -178,7 +178,7 @@ public class ClientConfig {
     }
 
     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 namesrvAddr;
diff --git a/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java
b/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java
index 85dc95f..68f8839 100644
--- a/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java
+++ b/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java
@@ -20,6 +20,7 @@ public class NameServerAddressUtils {
     public static final String INSTANCE_PREFIX = "MQ_INST_";
     public static final String INSTANCE_REGEX = INSTANCE_PREFIX + "\\w+_\\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 String getNameServerAddresses() {

Mime
View raw message