svn commit: r1564113 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

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

svn commit: r1564113 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

jleroux@apache.org
Author: jleroux
Date: Mon Feb  3 22:33:09 2014
New Revision: 1564113

URL: http://svn.apache.org/r1564113
Log:
When I replaced the deprecated findByPrimaryKey by a finByOne I forgot to put a catch around, this fixes it.
Also removed an useless logError, ServiceUtil.returnError will take care of it

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1564113&r1=1564112&r2=1564113&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Mon Feb  3 22:33:09 2014
@@ -1403,7 +1403,11 @@ public class OrderReturnServices {
                                     String orderPaymentPreferenceNewId = null;
                                     Map<String, Object> result = dispatcher.runSync("createOrderPaymentPreference", serviceContext);
                                     orderPaymentPreferenceNewId = (String) result.get("orderPaymentPreferenceId");
-                                    refundOrderPaymentPreference = delegator.findOne("OrderPaymentPreference", false, "orderPaymentPreferenceId", orderPaymentPreferenceNewId);
+                                    try {
+                                        refundOrderPaymentPreference = delegator.findOne("OrderPaymentPreference", false, "orderPaymentPreferenceId", orderPaymentPreferenceNewId);
+                                    } catch (GenericEntityException e) {
+                                        return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithTheRefundSeeLogs", locale));
+                                    }
                                     serviceResult = dispatcher.runSync("refundPayment", UtilMisc.<String, Object>toMap("orderPaymentPreference", refundOrderPaymentPreference, "refundAmount", amountToRefund.setScale(decimals, rounding), "userLogin", userLogin));
                                     if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) {
                                         Debug.logError("Error in refund payment: " + ServiceUtil.getErrorMessage(serviceResult), module);
@@ -1413,7 +1417,6 @@ public class OrderReturnServices {
                                     paymentId = (String) serviceResult.get("paymentId");
                                     amountRefunded = (BigDecimal) serviceResult.get("refundAmount");
                                 } catch (GenericServiceException e) {
-                                    Debug.logError(e, "Problem running the refundPayment service", module);
                                     return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithTheRefundSeeLogs", locale));
                                 }
                             } else if (paymentMethodTypeId.equals("EXT_BILLACT")) {