未验证 提交 1ec21de8 编写于 作者: 赵延 提交者: GitHub

groupName can't be empty. (#5196)

上级 8cef69e5
...@@ -46,6 +46,9 @@ public class NamingUtils { ...@@ -46,6 +46,9 @@ public class NamingUtils {
if (StringUtils.isBlank(serviceName)) { if (StringUtils.isBlank(serviceName)) {
throw new IllegalArgumentException("Param 'serviceName' is illegal, serviceName is blank"); 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; final String resultGroupedName = groupName + Constants.SERVICE_INFO_SPLITER + serviceName;
return resultGroupedName.intern(); return resultGroupedName.intern();
} }
...@@ -75,7 +78,7 @@ public class NamingUtils { ...@@ -75,7 +78,7 @@ public class NamingUtils {
* <pre> * <pre>
* serviceName = "@@"; the length = 0; illegal * serviceName = "@@"; the length = 0; illegal
* serviceName = "group@@"; the length = 1; 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 * serviceName = "group@@serviceName"; the length = 2; legal
* </pre> * </pre>
* *
...@@ -87,6 +90,9 @@ public class NamingUtils { ...@@ -87,6 +90,9 @@ public class NamingUtils {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Param 'serviceName' is illegal, it should be format as 'groupName@@serviceName'"); "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");
}
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册