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()))