You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/12/04 22:40:01 UTC

tomee git commit: no need to create the same exception over and over

Repository: tomee
Updated Branches:
  refs/heads/develop 8d3cf8843 -> 158f6e1eb


no need to create the same exception over and over


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/158f6e1e
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/158f6e1e
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/158f6e1e

Branch: refs/heads/develop
Commit: 158f6e1eb9344a45a0d7d93d3cb578dc35a1794c
Parents: 8d3cf88
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Thu Dec 4 22:39:42 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Thu Dec 4 22:39:42 2014 +0100

----------------------------------------------------------------------
 .../org/apache/openejb/cdi/transactional/InterceptorBase.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/158f6e1e/container/openejb-core/src/main/java/org/apache/openejb/cdi/transactional/InterceptorBase.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/transactional/InterceptorBase.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/transactional/InterceptorBase.java
index c62928b..bbfcce1 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/transactional/InterceptorBase.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/transactional/InterceptorBase.java
@@ -30,6 +30,8 @@ import java.io.Serializable;
 import java.lang.reflect.Method;
 
 public abstract class InterceptorBase implements Serializable {
+    private static final IllegalStateException ILLEGAL_STATE_EXCEPTION = new IllegalStateException("Can't use UserTransaction from @Transaction call");
+
     protected Object intercept(final InvocationContext ic) throws Exception {
         Exception error = null;
         TransactionPolicy policy = null;
@@ -38,7 +40,7 @@ public abstract class InterceptorBase implements Serializable {
         final RuntimeException oldEx;
         final IllegalStateException illegalStateException;
         if (forbidsUt) {
-            illegalStateException = new IllegalStateException("Can't use UserTransaction from @Transaction call");
+            illegalStateException = ILLEGAL_STATE_EXCEPTION;
             oldEx = CoreUserTransaction.error(illegalStateException);
         } else {
             illegalStateException = null;