Skip to content

Commit 00399dc

Browse files
committed
Reject null for returned CompletableFuture (avoiding subsequent NPE)
See gh-34708
1 parent e33adad commit 00399dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private Object executeSynchronized(CacheOperationInvoker invoker, Method method,
463463
() -> {
464464
CompletableFuture<?> invokeResult = ((CompletableFuture<?>) invokeOperation(invoker));
465465
if (invokeResult == null) {
466-
return null;
466+
throw new IllegalStateException("Returned CompletableFuture must not be null: " + method);
467467
}
468468
return invokeResult.exceptionallyCompose(ex -> {
469469
invokeFailure.set(true);

0 commit comments

Comments
 (0)