tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-2051 fixing include/exclude rules for @Tx
Date Fri, 02 Jun 2017 12:57:25 GMT
Repository: tomee
Updated Branches:
  refs/heads/master e16bc39b0 -> 810bdc03d


TOMEE-2051 fixing include/exclude rules for @Tx


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

Branch: refs/heads/master
Commit: 810bdc03d4b0b452b597de5f55ac1606adb8a41f
Parents: e16bc39
Author: rmannibucau <rmannibucau@apache.org>
Authored: Fri Jun 2 14:57:19 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Fri Jun 2 14:57:19 2017 +0200

----------------------------------------------------------------------
 .../cdi/transactional/InterceptorBase.java      |  2 +-
 .../cdi/transactional/TransactionalTest.java    | 39 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/810bdc03/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 c928805..a84e448 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
@@ -176,7 +176,7 @@ public abstract class InterceptorBase implements Serializable {
             final int excludeScore = contains(excludes, e);
 
             if (excludeScore < 0) {
-                return includeScore > 0 || isNotChecked(e, exceptionTypes);
+                return includeScore >= 0 || isNotChecked(e, exceptionTypes);
             }
             return includeScore - excludeScore > 0;
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/810bdc03/container/openejb-core/src/test/java/org/apache/openejb/cdi/transactional/TransactionalTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/cdi/transactional/TransactionalTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/cdi/transactional/TransactionalTest.java
index 4573ac5..05c1da6 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/cdi/transactional/TransactionalTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/cdi/transactional/TransactionalTest.java
@@ -337,6 +337,39 @@ public class TransactionalTest {
         }
     }
 
+    @Test
+    public void tomee2051() {
+        for (int i = 0; i < 2; i++) {
+            final AtomicInteger status = new AtomicInteger();
+            try {
+                bean.tomee2051(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            OpenEJB.getTransactionManager().getTransaction().registerSynchronization(new
Synchronization() {
+                                @Override
+                                public void beforeCompletion() {
+                                    // no-op
+                                }
+
+                                @Override
+                                public void afterCompletion(int state) {
+                                    status.set(state);
+                                }
+                            });
+                        } catch (final RollbackException | SystemException e) {
+                            fail();
+                        }
+                    }
+                });
+                fail();
+            } catch (final AnException e) {
+                // no-op
+            }
+            assertEquals(Status.STATUS_ROLLEDBACK, status.get());
+        }
+    }
+
     @Transactional(value = REQUIRED, rollbackOn = AnCheckedException.class)
     public static class TxBean {
         @Resource
@@ -405,6 +438,12 @@ public class TransactionalTest {
             throw new AnException();
         }
 
+        @Transactional(rollbackOn = AnException.class)
+        public void tomee2051(final Runnable r) throws AnException {
+            r.run();
+            throw new AnException();
+        }
+
         @Transactional(value = MANDATORY, rollbackOn = AnException.class)
         public void anException() {
             throw new AnException();


Mime
View raw message