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 62a3c7d41..ac9e434e3 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 @@ -163,5 +163,4 @@ public class Constants { public static final String NUMBER_PATTERN = "^\\d+$"; - public static final String COMMA_DIVISION = ","; } diff --git a/core/src/main/java/com/alibaba/nacos/core/utils/Constants.java b/core/src/main/java/com/alibaba/nacos/core/utils/Constants.java index b1014876a..c3c6231a9 100644 --- a/core/src/main/java/com/alibaba/nacos/core/utils/Constants.java +++ b/core/src/main/java/com/alibaba/nacos/core/utils/Constants.java @@ -57,4 +57,5 @@ public interface Constants { String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip"; String SYSTEM_PREFER_HOSTNAME_OVER_IP = "nacos.preferHostnameOverIp"; String WEN_CONTEXT_PATH = "server.servlet.context-path"; + String COMMA_DIVISION = ","; } diff --git a/core/src/main/java/com/alibaba/nacos/core/utils/SystemUtils.java b/core/src/main/java/com/alibaba/nacos/core/utils/SystemUtils.java index 016659597..d8e66df18 100644 --- a/core/src/main/java/com/alibaba/nacos/core/utils/SystemUtils.java +++ b/core/src/main/java/com/alibaba/nacos/core/utils/SystemUtils.java @@ -142,7 +142,7 @@ public class SystemUtils { int multiIndex = instance.indexOf(","); if (multiIndex > 0) { // support the format: ip1:port,ip2:port # multi inline - for (String ins : instance.split("[,]")) { + for (String ins : instance.split(Constants.COMMA_DIVISION)) { instanceList.add(ins); } } else {