add comma division with some case to use

This commit is contained in:
pbting 2019-08-16 09:45:47 +08:00
parent 3bd5dcb1cf
commit a6deeb1fed
3 changed files with 2 additions and 2 deletions

View File

@ -163,5 +163,4 @@ public class Constants {
public static final String NUMBER_PATTERN = "^\\d+$"; public static final String NUMBER_PATTERN = "^\\d+$";
public static final String COMMA_DIVISION = ",";
} }

View File

@ -57,4 +57,5 @@ public interface Constants {
String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip"; String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip";
String SYSTEM_PREFER_HOSTNAME_OVER_IP = "nacos.preferHostnameOverIp"; String SYSTEM_PREFER_HOSTNAME_OVER_IP = "nacos.preferHostnameOverIp";
String WEN_CONTEXT_PATH = "server.servlet.context-path"; String WEN_CONTEXT_PATH = "server.servlet.context-path";
String COMMA_DIVISION = ",";
} }

View File

@ -142,7 +142,7 @@ public class SystemUtils {
int multiIndex = instance.indexOf(","); int multiIndex = instance.indexOf(",");
if (multiIndex > 0) { if (multiIndex > 0) {
// support the format: ip1:port,ip2:port # multi inline // 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); instanceList.add(ins);
} }
} else { } else {