From a213599c11ea248b627e631642bf880d21db5796 Mon Sep 17 00:00:00 2001 From: thcai Date: Mon, 5 Aug 2024 18:31:22 +0200 Subject: [PATCH] orElse limit --- .../com/michelin/ns4kafka/controller/acl/AclController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/michelin/ns4kafka/controller/acl/AclController.java b/src/main/java/com/michelin/ns4kafka/controller/acl/AclController.java index 07dfc6f4..c1649c58 100644 --- a/src/main/java/com/michelin/ns4kafka/controller/acl/AclController.java +++ b/src/main/java/com/michelin/ns4kafka/controller/acl/AclController.java @@ -50,12 +50,8 @@ public class AclController extends NamespacedResourceController { @Get("{?limit}") public List list(String namespace, Optional limit, @QueryValue(defaultValue = "*") String name) { - if (limit.isEmpty()) { - limit = Optional.of(AclLimit.ALL); - } - Namespace ns = getNamespace(namespace); - return switch (limit.get()) { + return switch (limit.orElse(AclLimit.ALL)) { case GRANTEE -> aclService.findByWildcardNameGrantedToNamespace(ns, name) .stream() .sorted(Comparator.comparing((AccessControlEntry acl) -> acl.getMetadata().getNamespace()))