From d9d79dd21c2c6789710d6ac01051669d0cd6b0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E7=A6=B9=E5=85=89?= Date: Thu, 1 Aug 2019 20:28:33 +0800 Subject: [PATCH] Remove unnecessary code --- .../alibaba/nacos/naming/controllers/CatalogController.java | 6 ++---- .../java/com/alibaba/nacos/naming/core/ServiceManager.java | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/controllers/CatalogController.java b/naming/src/main/java/com/alibaba/nacos/naming/controllers/CatalogController.java index 488e6ae9e..60093e1c0 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/controllers/CatalogController.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/controllers/CatalogController.java @@ -151,10 +151,9 @@ public class CatalogController { int pageNo = Integer.parseInt(WebUtils.required(request, "pageNo")); int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize")); String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY); - String groupName = WebUtils.optional(request, "groupName", StringUtils.EMPTY); List serviceList = new ArrayList<>(8); - serviceManager.getPagedService(namespaceId, pageNo, pageSize, serviceName, groupName, StringUtils.EMPTY, serviceList, false); + serviceManager.getPagedService(namespaceId, pageNo, pageSize, serviceName, StringUtils.EMPTY, serviceList, false); for (Service service : serviceList) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); @@ -259,12 +258,11 @@ public class CatalogController { int page = Integer.parseInt(WebUtils.required(request, "pageNo")); int pageSize = Integer.parseInt(WebUtils.required(request, "pageSize")); String serviceName = WebUtils.optional(request, "serviceName", StringUtils.EMPTY); - String groupName = WebUtils.optional(request, "groupName", StringUtils.EMPTY); String containedInstance = WebUtils.optional(request, "instance", StringUtils.EMPTY); boolean hasIpCount = Boolean.parseBoolean(WebUtils.optional(request, "hasIpCount", "false")); List services = new ArrayList<>(); - int total = serviceManager.getPagedService(namespaceId, page - 1, pageSize, serviceName, groupName, containedInstance, services, hasIpCount); + int total = serviceManager.getPagedService(namespaceId, page - 1, pageSize, serviceName, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.put("serviceList", Collections.emptyList()); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java b/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java index 62dc25e57..e65cb358d 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/ServiceManager.java @@ -676,7 +676,7 @@ public class ServiceManager implements RecordListener { return serviceMap.get(namespaceId); } - public int getPagedService(String namespaceId, int startPage, int pageSize, String serviceName, String groupName, String containedInstance, List serviceList, boolean hasIpCount) { + public int getPagedService(String namespaceId, int startPage, int pageSize, String serviceName, String containedInstance, List serviceList, boolean hasIpCount) { List matchList; @@ -684,8 +684,8 @@ public class ServiceManager implements RecordListener { return 0; } - if (StringUtils.isNotBlank(serviceName) || StringUtils.isNotBlank(groupName)) { - matchList = searchServices(namespaceId, StringUtils.isNotBlank(serviceName) ? ".*" + serviceName + ".*" : null, groupName); + if (StringUtils.isNotBlank(serviceName)) { + matchList = searchServices(namespaceId, ".*" + serviceName + ".*"); } else { matchList = new ArrayList<>(chooseServiceMap(namespaceId).values()); }