You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/05/21 07:01:01 UTC

svn commit: r540027 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java

Author: jaz
Date: Sun May 20 22:00:58 2007
New Revision: 540027

URL: http://svn.apache.org/viewvc?view=rev&rev=540027
Log:
added transaction to index keywords (7200)

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?view=diff&rev=540027&r1=540026&r2=540027
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Sun May 20 22:00:58 2007
@@ -309,7 +309,10 @@
         int numProds = 0;
         int errProds = 0;
 
+        boolean beganTx = false;
         try {
+            // begin the transaction
+            beganTx = TransactionUtil.begin(7200);
             try {
                 if (Debug.infoOn()) {
                     long count = delegator.findCountByCondition("Product", condition, null);
@@ -340,10 +343,20 @@
                 }
             }
         } catch (GenericEntityException e) {
+            try {
+                TransactionUtil.rollback(beganTx, e.getMessage(), e);
+            } catch (Exception e1) {
+                Debug.logError(e1, module);
+            }
             return "error";
         } catch (Throwable t) {
             Debug.logError(t, module);
             request.setAttribute("_ERROR_MESSAGE_", t.getMessage());
+            try {
+                TransactionUtil.rollback(beganTx, t.getMessage(), t);
+            } catch (Exception e2) {
+                Debug.logError(e2, module);
+            }
             return "error";
         } finally {
             if (entityListIterator != null) {
@@ -352,6 +365,13 @@
                 } catch (GenericEntityException gee) {
                     Debug.logError(gee, "Error closing EntityListIterator when indexing product keywords.", module);
                 }
+            }
+
+            // commit the transaction
+            try {
+                TransactionUtil.commit(beganTx);
+            } catch (Exception e) {
+                Debug.logError(e, module);
             }
         }