svn commit: r1343089 - in /ofbiz/branches/release12.04: ./ applications/order/src/org/ofbiz/order/order/OrderServices.java

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

svn commit: r1343089 - in /ofbiz/branches/release12.04: ./ applications/order/src/org/ofbiz/order/order/OrderServices.java

jleroux@apache.org
Author: jleroux
Date: Sun May 27 20:29:27 2012
New Revision: 1343089

URL: http://svn.apache.org/viewvc?rev=1343089&view=rev
Log:
"Applied fix from trunk for revision: 1343088"
------------------------------------------------------------------------
r1343088 | jleroux | 2012-05-27 22:28:16 +0200 (dim., 27 mai 2012) | 12 lines

Fixes this error found by chance in log

---- exception report ----------------------------------------------------------
ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.
Exception: java.lang.Exception
Message: Stack Trace
---- stack trace ---------------------------------------------------------------
java.lang.Exception: Stack Trace
org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1751)
org.ofbiz.order.order.OrderServices$1.call(OrderServices.java:5610)
org.ofbiz.order.order.OrderServices$1.call(OrderServices.java:5605)

------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1343088

Modified: ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1343089&r1=1343088&r2=1343089&view=diff
==============================================================================
--- ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun May 27 20:29:27 2012
@@ -5600,7 +5600,9 @@ public class OrderServices {
         }
         final EntityCondition cond = EntityCondition.makeCondition(orderCondList);
         List<String> orderIds;
+        boolean beganTransaction = false;
         try {
+            beganTransaction = TransactionUtil.begin();
             orderIds = TransactionUtil.doNewTransaction(new Callable<List<String>>() {
                 public List<String> call() throws Exception {
                     List<String> orderIds = new LinkedList<String>();
@@ -5621,8 +5623,20 @@ public class OrderServices {
             }, "getSalesOrderIds", 0, true);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
+            try {
+                TransactionUtil.rollback(beganTransaction, e.getMessage(), e);
+            } catch (GenericTransactionException e2) {
+                Debug.logError(e2, "Unable to rollback transaction", module);
+            }
             return ServiceUtil.returnError(e.getMessage());
+        } finally {
+            try {
+                TransactionUtil.commit(beganTransaction);
+            } catch (GenericTransactionException e) {
+                Debug.logError(e, "Unable to commit transaction", module);
+            }
         }
+
         for (String orderId: orderIds) {
             Map<String, Object> svcIn = FastMap.newInstance();
             svcIn.put("userLogin", context.get("userLogin"));