ChrisSamo632 commented on code in PR #6750: URL: https://github.com/apache/nifi/pull/6750#discussion_r1059061359
########## nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java: ########## @@ -494,22 +495,26 @@ public Response createFlowRegistryClient( preprocessObsoleteRequest(requestFlowRegistryClientEntity); if (requestFlowRegistryClientEntity == null || requestFlowRegistryClientEntity.getComponent() == null) { - throw new IllegalArgumentException("Flow registry client details must be specified."); + throw new IllegalArgumentException("Flow Registry client details must be specified."); } if (requestFlowRegistryClientEntity.getRevision() == null || (requestFlowRegistryClientEntity.getRevision().getVersion() == null || requestFlowRegistryClientEntity.getRevision().getVersion() != 0)) { - throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Registry."); + throw new IllegalArgumentException("A revision of 0 must be specified when creating a new Flow Registry."); } final FlowRegistryClientDTO requestRegistryClient = requestFlowRegistryClientEntity.getComponent(); if (requestRegistryClient.getId() != null) { - throw new IllegalArgumentException("Registry ID cannot be specified."); + throw new IllegalArgumentException("Flow Registry ID cannot be specified."); } if (StringUtils.isBlank(requestRegistryClient.getName())) { - throw new IllegalArgumentException("Registry name must be specified."); + throw new IllegalArgumentException("Flow Registry name must be specified."); + } + + if (serviceFacade.getRegistryClients().stream().map(rce -> rce.getComponent().getName()).collect(Collectors.toSet()).contains(requestRegistryClient.getName())) { Review Comment: ```suggestion if (serviceFacade.getRegistryClients().stream().anyMatch(rce -> requestRegistryClient.getName().equals(rce.getComponent().getName()))) { ``` I think use of the `anyMatch` stream function is more obvious than collecting everything into a `Set` and checking for `contains` -- 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: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org