From ff8655846d9c6903f16730efc1650a4ae55866b9 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 27 Oct 2014 15:47:52 +0100 Subject: [PATCH] TransactionAspectSupport.currentTransactionStatus() reliably throws NoTransactionException Issue: SPR-9144 --- .../transaction/interceptor/TransactionAspectSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java index 60a5b124265..fdf16411b6b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,10 +111,10 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init */ public static TransactionStatus currentTransactionStatus() throws NoTransactionException { TransactionInfo info = currentTransactionInfo(); - if (info == null) { + if (info == null || info.transactionStatus == null) { throw new NoTransactionException("No transaction aspect-managed TransactionStatus in scope"); } - return currentTransactionInfo().transactionStatus; + return info.transactionStatus; }