Skip to content

Commit 8001061

Browse files
committed
Improve null-safety of module/spring-boot-cache
See gh-46926
1 parent f51f872 commit 8001061

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

module/spring-boot-cache/src/main/java/org/springframework/boot/cache/actuate/endpoint/CachesEndpointWebExtension.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.cache.actuate.endpoint;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
2022
import org.springframework.boot.actuate.endpoint.annotation.OptionalParameter;
2123
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
@@ -41,7 +43,7 @@ public CachesEndpointWebExtension(CachesEndpoint delegate) {
4143

4244
@ReadOperation
4345
public WebEndpointResponse<CacheEntryDescriptor> cache(@Selector String cache,
44-
@OptionalParameter String cacheManager) {
46+
@OptionalParameter @Nullable String cacheManager) {
4547
try {
4648
CacheEntryDescriptor entry = this.delegate.cache(cache, cacheManager);
4749
int status = (entry != null) ? WebEndpointResponse.STATUS_OK : WebEndpointResponse.STATUS_NOT_FOUND;
@@ -53,7 +55,8 @@ public WebEndpointResponse<CacheEntryDescriptor> cache(@Selector String cache,
5355
}
5456

5557
@DeleteOperation
56-
public WebEndpointResponse<Void> clearCache(@Selector String cache, @OptionalParameter String cacheManager) {
58+
public WebEndpointResponse<Void> clearCache(@Selector String cache,
59+
@OptionalParameter @Nullable String cacheManager) {
5760
try {
5861
boolean cleared = this.delegate.clearCache(cache, cacheManager);
5962
int status = (cleared ? WebEndpointResponse.STATUS_NO_CONTENT : WebEndpointResponse.STATUS_NOT_FOUND);

0 commit comments

Comments
 (0)