glassfish
  1. glassfish
  2. GLASSFISH-20533

@Transactional.rollbackOn and @Transactional.dontRollbackOn doesn't cover subclasses

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: 4.1
    • Component/s: jts
    • Labels:
      None

      Description

      The JTA 1.2 spec states (p27), when discussing rollbackOn and dontRollbackOn:

      When a class is specified for either of these elements, the designated behavior applies to subclasses of that class as well

      It looks like the code is not checking for subclasses as it uses .equals rather than .isAssignableFrom:

                  if(rollbackOn!=null) {
                      for (Class aRollbackOn : rollbackOn) {
                          if (aRollbackOn.equals(checkException.getClass())) markRollbackIfActiveTransaction();
                      }
                  }
      
                      for (Class aDontRollbackOn : dontRollbackOn) {
                          if (aDontRollbackOn.equals(runtimeException.getClass())) {
                              throw runtimeException;
                          }
                      }
      

      See here:
      https://java.net/projects/glassfish/sources/svn/content/trunk/main/appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorBase.java?rev=61989

        Activity

        Hide
        paul_parkinson added a comment -

        I've made the fix and am writing tests for commit to trunk tonight, however, it is too late for 4.0 and so this is targeted for 4.0.1 and release noting as appropriate.

        Show
        paul_parkinson added a comment - I've made the fix and am writing tests for commit to trunk tonight, however, it is too late for 4.0 and so this is targeted for 4.0.1 and release noting as appropriate.
        Hide
        paul_parkinson added a comment -

        Fixed...

        svn commit -m "GLASSFISH-20532 wrong @Priority and GLASSFISH-20533 rollbackOn dontRollbackOn inheritance fixes and tests"
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorBase.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorMandatory.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorNever.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorNotSupported.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorRequired.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorRequiresNew.java
        Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorSupports.java
        Adding appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/BeanMethodLevelAll.java
        Adding appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/BeanSpecExampleOfRollbackDontRollback.java
        Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/Transaction.java
        Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/TransactionManager.java
        Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/TransactionalAnnotationTest.java
        Transmitting file data ............
        Committed revision 62101.

        Show
        paul_parkinson added a comment - Fixed... svn commit -m " GLASSFISH-20532 wrong @Priority and GLASSFISH-20533 rollbackOn dontRollbackOn inheritance fixes and tests" Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorBase.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorMandatory.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorNever.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorNotSupported.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorRequired.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorRequiresNew.java Sending appserver/web/weld-integration/src/main/java/org/glassfish/cdi/transaction/TransactionalInterceptorSupports.java Adding appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/BeanMethodLevelAll.java Adding appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/BeanSpecExampleOfRollbackDontRollback.java Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/Transaction.java Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/TransactionManager.java Sending appserver/web/weld-integration/src/test/java/org/glassfish/cdi/transaction/TransactionalAnnotationTest.java Transmitting file data ............ Committed revision 62101.

          People

          • Assignee:
            paul_parkinson
            Reporter:
            paul.robinson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: