Skip to content

Commit ff86558

Browse files
committed
TransactionAspectSupport.currentTransactionStatus() reliably throws NoTransactionException
Issue: SPR-9144
1 parent da612d0 commit ff86558

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,10 +111,10 @@ protected static TransactionInfo currentTransactionInfo() throws NoTransactionEx
111111
*/
112112
public static TransactionStatus currentTransactionStatus() throws NoTransactionException {
113113
TransactionInfo info = currentTransactionInfo();
114-
if (info == null) {
114+
if (info == null || info.transactionStatus == null) {
115115
throw new NoTransactionException("No transaction aspect-managed TransactionStatus in scope");
116116
}
117-
return currentTransactionInfo().transactionStatus;
117+
return info.transactionStatus;
118118
}
119119

120120

0 commit comments

Comments
 (0)