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

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1564113 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
index 081ad44..88be2aa 100644
--- a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
+++ b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
@@ -1403,7 +1403,11 @@
                                     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 @@
                                     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")) {