Merge pull request #689 from alibaba/hotfix_ip4Dom2_dom_parse_error

Fix #688
This commit is contained in:
Fury Zhu 2019-01-23 16:13:43 +08:00 committed by GitHub
commit db9489b9c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,9 +175,19 @@ public class ApiCommands {
@RequestMapping("/ip4Dom2")
public JSONObject ip4Dom2(HttpServletRequest request) throws NacosException {
String namespaceId = WebUtils.optional(request, Constants.REQUEST_PARAM_NAMESPACE_ID,
UtilsAndCommons.getDefaultNamespaceId());
String domName = WebUtils.required(request, "dom");
String key = WebUtils.required(request, "dom");
String domName;
String namespaceId;
if (key.contains(UtilsAndCommons.SERVICE_GROUP_CONNECTOR)) {
namespaceId = key.split(UtilsAndCommons.SERVICE_GROUP_CONNECTOR)[0];
domName = key.split(UtilsAndCommons.SERVICE_GROUP_CONNECTOR)[1];
} else {
namespaceId = UtilsAndCommons.getDefaultNamespaceId();
domName = key;
}
VirtualClusterDomain dom = (VirtualClusterDomain) domainsManager.getDomain(namespaceId, domName);