Skip to content

Commit

Permalink
[ISSUE #8925] fix that the replaceAll operation is invalid (#8929)
Browse files Browse the repository at this point in the history
Close #8925
  • Loading branch information
onewe authored Aug 12, 2022
1 parent 21b624e commit 8f8a1f3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
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 8f8a1f3

Please sign in to comment.