svn commit: r536689 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r536689 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

jaz-3
Author: jaz
Date: Wed May  9 15:14:30 2007
New Revision: 536689

URL: http://svn.apache.org/viewvc?view=rev&rev=536689
Log:
appears GeronimoTXM throws IllegalStateExceptions under certain conditions in transactions; this will cause the transaction to hang since it is never caught; now catching this

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?view=diff&rev=536689&r1=536688&r2=536689
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Wed May  9 15:14:30 2007
@@ -186,7 +186,7 @@
 
                     Debug.logVerbose("[TransactionUtil.commit] transaction committed", module);
                 } else {
-                    Debug.logInfo("[TransactionUtil.commit] Not committing transaction, status is STATUS_NO_TRANSACTION", module);
+                    Debug.logWarning("[TransactionUtil.commit] Not committing transaction, status is STATUS_NO_TRANSACTION", module);
                 }
             } catch (RollbackException e) {
                 RollbackOnlyCause rollbackOnlyCause = getSetRollbackOnlyCause();
@@ -203,6 +203,9 @@
                     Throwable t = e.getCause() == null ? e : e.getCause();
                     throw new GenericTransactionException("Roll back error (with no rollbackOnly cause found), could not commit transaction, was rolled back instead: " + t.toString(), t);
                 }
+            } catch (IllegalStateException e) {
+                Throwable t = e.getCause() == null ? e : e.getCause();
+                throw new GenericTransactionException("Could not commit transaction, IllegalStateException exception: " + t.toString(), t);
             } catch (HeuristicMixedException e) {
                 Throwable t = e.getCause() == null ? e : e.getCause();
                 throw new GenericTransactionException("Could not commit transaction, HeuristicMixed exception: " + t.toString(), t);
@@ -261,11 +264,14 @@
                     ut.rollback();
                     Debug.logInfo("[TransactionUtil.rollback] transaction rolled back", module);
                 } else {
-                    Debug.logInfo("[TransactionUtil.rollback] transaction not rolled back, status is STATUS_NO_TRANSACTION", module);
+                    Debug.logWarning("[TransactionUtil.rollback] transaction not rolled back, status is STATUS_NO_TRANSACTION", module);
                 }
+            } catch (IllegalStateException e) {
+                Throwable t = e.getCause() == null ? e : e.getCause();
+                throw new GenericTransactionException("Could not rollback transaction, IllegalStateException exception: " + t.toString(), t);
             } catch (SystemException e) {
-                //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
-                throw new GenericTransactionException("System error, could not rollback transaction", e);
+                Throwable t = e.getCause() == null ? e : e.getCause();
+                throw new GenericTransactionException("System error, could not rollback transaction: " + t.toString(), t);
             }
         } else {
             Debug.logInfo("[TransactionUtil.rollback] No UserTransaction, transaction not rolled back", module);
@@ -289,11 +295,14 @@
                         Debug.logInfo("[TransactionUtil.setRollbackOnly] transaction rollback only not set, rollback only is already set.", module);
                     }
                 } else {
-                    Debug.logInfo("[TransactionUtil.setRollbackOnly] transaction rollback only not set, status is STATUS_NO_TRANSACTION", module);
-                }
+                    Debug.logWarning("[TransactionUtil.setRollbackOnly] transaction rollback only not set, status is STATUS_NO_TRANSACTION", module);
+                }            
+            } catch (IllegalStateException e) {
+                Throwable t = e.getCause() == null ? e : e.getCause();
+                throw new GenericTransactionException("Could not set rollback only on transaction, IllegalStateException exception: " + t.toString(), t);
             } catch (SystemException e) {
-                //This is Java 1.4 only, but useful for certain debuggins: Throwable t = e.getCause() == null ? e : e.getCause();
-                throw new GenericTransactionException("System error, could not set rollback only on transaction", e);
+                Throwable t = e.getCause() == null ? e : e.getCause();
+                throw new GenericTransactionException("System error, could not set rollback only on transaction: " + t.toString(), t);
             }
         } else {
             Debug.logInfo("[TransactionUtil.setRollbackOnly] No UserTransaction, transaction rollback only not set", module);