diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java index ac538c616c..0930901cad 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java @@ -186,6 +186,7 @@ public final class EndpointRequest { } private PathPatternParserServerWebExchangeMatcher getDelegateMatcher(String path) { + Assert.notNull(path, "'path' must not be null"); return new PathPatternParserServerWebExchangeMatcher(path + "/**"); } @@ -310,11 +311,18 @@ public final class EndpointRequest { if (this.includeLinks && StringUtils.hasText(endpoints.getBasePath())) { delegateMatchers.add(new LinksServerWebExchangeMatcher()); } + if (delegateMatchers.isEmpty()) { + return EMPTY_MATCHER; + } return new OrServerWebExchangeMatcher(delegateMatchers); } private Stream streamPaths(List source, PathMappedEndpoints endpoints) { - return source.stream().filter(Objects::nonNull).map(this::getEndpointId).map(endpoints::getPath); + return source.stream() + .filter(Objects::nonNull) + .map(this::getEndpointId) + .map(endpoints::getPath) + .filter(Objects::nonNull); } @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java index 6fcc163062..5054f47586 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java @@ -329,11 +329,18 @@ public final class EndpointRequest { if (this.includeLinks && StringUtils.hasText(basePath)) { delegateMatchers.addAll(getLinksMatchers(requestMatcherFactory, matcherProvider, basePath)); } + if (delegateMatchers.isEmpty()) { + return EMPTY_MATCHER; + } return new OrRequestMatcher(delegateMatchers); } private Stream streamPaths(List source, PathMappedEndpoints endpoints) { - return source.stream().filter(Objects::nonNull).map(this::getEndpointId).map(endpoints::getPath); + return source.stream() + .filter(Objects::nonNull) + .map(this::getEndpointId) + .map(endpoints::getPath) + .filter(Objects::nonNull); } @Override @@ -435,6 +442,7 @@ public final class EndpointRequest { RequestMatcher antPath(RequestMatcherProvider matcherProvider, String... parts) { StringBuilder pattern = new StringBuilder(); for (String part : parts) { + Assert.notNull(part, "'part' must not be null"); pattern.append(part); } return matcherProvider.getRequestMatcher(pattern.toString());