Skip to content

Commit

Permalink
groupName can't be empty. (alibaba#5196)
Browse files Browse the repository at this point in the history
  • Loading branch information
horizonzy authored Mar 26, 2021
1 parent 8cef69e commit 1ec21de
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static String getGroupedName(final String serviceName, final String group
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();
}
Expand Down Expand Up @@ -75,7 +78,7 @@ public static String getGroupName(final String serviceNameWithGroup) {
* <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>
*
Expand All @@ -87,6 +90,9 @@ public static void checkServiceNameFormat(String combineServiceName) {
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");
}
}

/**
Expand Down

0 comments on commit 1ec21de

Please sign in to comment.