Author: jleroux
Date: Sun May 27 20:28:16 2012
New Revision: 1343088
URL:
http://svn.apache.org/viewvc?rev=1343088&view=revLog:
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/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1343088&r1=1343087&r2=1343088&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun May 27 20:28:16 2012
@@ -5601,7 +5601,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>();
@@ -5622,8 +5624,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"));