moremind commented on code in PR #5598: URL: https://github.com/apache/shenyu/pull/5598#discussion_r1802730364
########## shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/ConfigController.java: ########## @@ -35,36 +40,50 @@ import java.util.Map; +import static org.apache.shenyu.common.constant.Constants.SYS_DEFAULT_NAMESPACE_ID; + /** * This Controller only when HttpLongPollingDataChangedListener exist, will take effect. */ @ResponseBody @RequestMapping("/configs") @RestController public class ConfigController { - + private final HttpLongPollingDataChangedListener longPollingListener; - - public ConfigController(final HttpLongPollingDataChangedListener longPollingListener) { + + private final NamespaceService namespaceService; + + public ConfigController(final HttpLongPollingDataChangedListener longPollingListener, final NamespaceService namespaceService) { this.longPollingListener = longPollingListener; + this.namespaceService = namespaceService; } - + /** * Fetch configs shenyu result. * * @param groupKeys the group keys + * @param namespaceIdParams namespaceIdParams * @return the shenyu result */ @GetMapping("/fetch") - public ShenyuAdminResult fetchConfigs(@NotNull final String[] groupKeys) { + public ShenyuAdminResult fetchConfigs(@NotNull final String[] groupKeys, final String namespaceIdParams) { + String namespaceId = namespaceIdParams; + NamespaceVO existNamespace = namespaceService.findById(namespaceId); + if (StringUtils.isNotEmpty(namespaceId) && ObjectUtils.isEmpty(existNamespace)) { + throw new ShenyuAdminException("namespaceId is not exist"); + } + if (StringUtils.isEmpty(namespaceId)) { Review Comment: you should refactor the code -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org