Skip to content

Commit

Permalink
[ISSUE #8925] fix that the replaceAll operation is invalid
Browse files Browse the repository at this point in the history
Close #8925
  • Loading branch information
onewe committed Aug 10, 2022
1 parent 3586ad6 commit 3645c73
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -223,24 +223,24 @@ public ServerListManager(Properties properties) throws NacosException {
}

private String initServerName(Properties properties) {
String serverName = "";
String serverName;
//1.user define server name.
if (properties != null && properties.containsKey(PropertyKeyConst.SERVER_NAME)) {
serverName = properties.get(PropertyKeyConst.SERVER_NAME).toString();
} else {
// if fix url,use fix url join string.
if (isFixed) {
serverName = FIXED_NAME + "-" + (StringUtils.isNotBlank(namespace) ? (StringUtils.trim(namespace) + "-")
: "") + getFixedNameSuffix(serverUrls.toArray(new String[serverUrls.size()]));
: "") + getFixedNameSuffix(serverUrls.toArray(new String[0]));
} else {
//if use endpoint , use endpoint ,content path ,serverlist name
serverName = CUSTOM_NAME + "-" + String
.join("_", endpoint, String.valueOf(endpointPort), contentPath, serverListName) + (
StringUtils.isNotBlank(namespace) ? ("_" + StringUtils.trim(namespace)) : "");
}
}
serverName.replaceAll("\\/", "_");
serverName.replaceAll("\\:", "_");
serverName = serverName.replaceAll("\\/", "_");
serverName = serverName.replaceAll("\\:", "_");

return serverName;
}
Expand Down

0 comments on commit 3645c73

Please sign in to comment.