groupName can't be empty. (#5196)

This commit is contained in:
赵延 2021-03-26 09:54:13 +08:00 committed by GitHub
parent 8cef69e502
commit 1ec21de8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,9 @@ public class NamingUtils {
if (StringUtils.isBlank(serviceName)) {
throw new IllegalArgumentException("Param 'serviceName' is illegal, serviceName is blank");
}
if (StringUtils.isBlank(groupName)) {
throw new IllegalArgumentException("Param 'groupName' is illegal, groupName is blank");
}
final String resultGroupedName = groupName + Constants.SERVICE_INFO_SPLITER + serviceName;
return resultGroupedName.intern();
}
@ -75,7 +78,7 @@ public class NamingUtils {
* <pre>
* serviceName = "@@"; the length = 0; illegal
* serviceName = "group@@"; the length = 1; illegal
* serviceName = "@@serviceName"; the length = 2; legal
* serviceName = "@@serviceName"; the length = 2; illegal
* serviceName = "group@@serviceName"; the length = 2; legal
* </pre>
*
@ -87,6 +90,9 @@ public class NamingUtils {
throw new IllegalArgumentException(
"Param 'serviceName' is illegal, it should be format as 'groupName@@serviceName'");
}
if (split[0].isEmpty()) {
throw new IllegalArgumentException("Param 'serviceName' is illegal, groupName can't be empty");
}
}
/**