From 9ccbeec94748e825b438dce2acad7da44ed82b3d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 23 Jun 2023 12:01:16 +0200 Subject: [PATCH] Ignore null message when introspecting resource cleanup failure This commit fixes a regression introduced in conjunction with gh-27572. See gh-30597 Closes gh-30729 --- .../transaction/reactive/TransactionalOperatorImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java index e40057c22d51..d812235dd9dc 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java +++ b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionalOperatorImpl.java @@ -112,10 +112,11 @@ private Mono rollbackOnException(ReactiveTransaction status, Throwable ex) * @param ex the throwable to try to unwrap */ private Throwable unwrapIfResourceCleanupFailure(Throwable ex) { - if (ex instanceof RuntimeException && - ex.getCause() != null && - ex.getMessage().startsWith("Async resource cleanup failed")) { - return ex.getCause(); + if (ex instanceof RuntimeException && ex.getCause() != null) { + String msg = ex.getMessage(); + if (msg != null && msg.startsWith("Async resource cleanup failed")) { + return ex.getCause(); + } } return ex; }