diff --git a/api/src/main/java/com/alibaba/nacos/api/common/Constants.java b/api/src/main/java/com/alibaba/nacos/api/common/Constants.java index f81a93491..9d1d1de0e 100644 --- a/api/src/main/java/com/alibaba/nacos/api/common/Constants.java +++ b/api/src/main/java/com/alibaba/nacos/api/common/Constants.java @@ -176,6 +176,8 @@ public class Constants { public static final String SERVICE_INFO_SPLITER = "@@"; + public static final int SERVICE_INFO_SPLIT_COUNT = 2; + public static final String NULL_STRING = "null"; public static final String NUMBER_PATTERN = "^\\d+$"; diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java b/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java index 6c7621f1d..3c2ce6b04 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java @@ -941,7 +941,7 @@ public class ServiceManager implements RecordListener { if (StringUtils.isNotBlank(param)) { StringJoiner regex = new StringJoiner(Constants.SERVICE_INFO_SPLITER); - for (String s : param.split(Constants.SERVICE_INFO_SPLITER)) { + for (String s : param.split(Constants.SERVICE_INFO_SPLITER, Constants.SERVICE_INFO_SPLIT_COUNT)) { regex.add(StringUtils.isBlank(s) ? Constants.ANY_PATTERN : Constants.ANY_PATTERN + s + Constants.ANY_PATTERN); }