You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/12/31 11:11:47 UTC

svn commit: r1819730 [5/6] - in /ofbiz/ofbiz-framework/trunk/applications: content/src/main/java/org/apache/ofbiz/content/ content/src/main/java/org/apache/ofbiz/content/compdoc/ content/src/main/java/org/apache/ofbiz/content/content/ content/src/main/...

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java Sun Dec 31 11:11:46 2017
@@ -514,6 +514,9 @@ public class CheckOutHelper {
                 Map<String, Object> gcResult = null;
                 try {
                     gcResult = dispatcher.runSync("createGiftCard", gcCtx);
+                    if (ServiceUtil.isError(gcResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(gcResult));
+                    }
                 } catch (GenericServiceException e) {
                     Debug.logError(e, module);
                     errorMessages.add(e.getMessage());
@@ -686,7 +689,10 @@ public class CheckOutHelper {
                 try {
                     /* OrderRequirementCommitment records will map which POs which are created from which requirements. With the help of this mapping requirements will be updated to Ordered when POs will be approved.  */
                     Map<String, Object> inputMap = UtilMisc.toMap("userLogin", userLogin, "orderId", orderId, "orderItemSeqId", shoppingCartItem.getOrderItemSeqId(), "requirementId", requirementId, "quantity", shoppingCartItem.getQuantity());
-                    dispatcher.runSync("createOrderRequirementCommitment", inputMap);
+                    Map<String, Object> serviceResult = dispatcher.runSync("createOrderRequirementCommitment", inputMap);
+                    if (ServiceUtil.isError(serviceResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                    }
                 } catch (GenericServiceException e) {
                     String service = e.getMessage();
                     Map<String, String> messageMap = UtilMisc.toMap("service", service);
@@ -904,15 +910,15 @@ public class CheckOutHelper {
 
         try {
             serviceResult = dispatcher.runSync(taxService, serviceContext);
+            if (ServiceUtil.isError(serviceResult)) {
+                String errorMessage = ServiceUtil.getErrorMessage(serviceResult);
+                Debug.logError(errorMessage, module);
+                throw new GeneralException(errorMessage);
+            }
         } catch (GenericServiceException e) {
             Debug.logError(e, module);
             throw new GeneralException("Problem occurred in tax service (" + e.getMessage() + ")", e);
         }
-
-        if (ServiceUtil.isError(serviceResult)) {
-            throw new GeneralException(ServiceUtil.getErrorMessage(serviceResult));
-        }
-
         // the adjustments (returned in order) from taxware.
         List<GenericValue> orderAdj = UtilGenerics.checkList(serviceResult.get("orderAdjustments"));
         List<List<GenericValue>> itemAdj = UtilGenerics.checkList(serviceResult.get("itemAdjustments"));
@@ -969,8 +975,10 @@ public class CheckOutHelper {
                 authCtx.put("currencyUomId", currencyUomId);
 
                 Map<String, Object> authResp = dispatcher.runSync("processAuthResult", authCtx);
-                if (authResp != null && ServiceUtil.isError(authResp)) {
-                    throw new GeneralException(ServiceUtil.getErrorMessage(authResp));
+                if (ServiceUtil.isError(authResp)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(authResp);
+                    Debug.logError(errorMessage, module);
+                    throw new GeneralException(errorMessage);
                 }
 
                 // approve the order
@@ -990,8 +998,10 @@ public class CheckOutHelper {
                     captCtx.put("currencyUomId", currencyUomId);
 
                     Map<String, Object> capResp = dispatcher.runSync("processCaptureResult", captCtx);
-                    if (capResp != null && ServiceUtil.isError(capResp)) {
-                        throw new GeneralException(ServiceUtil.getErrorMessage(capResp));
+                    if (ServiceUtil.isError(capResp)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(capResp);
+                        Debug.logError(errorMessage, module);
+                        throw new GeneralException(errorMessage);
                     }
                 }
             }
@@ -1030,6 +1040,11 @@ public class CheckOutHelper {
                 // invoke the payment gateway service.
                 paymentResult = dispatcher.runSync("authOrderPayments",
                         UtilMisc.<String, Object>toMap("orderId", orderId, "userLogin", userLogin), 180, false);
+                if (ServiceUtil.isError(paymentResult)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(paymentResult);
+                    Debug.logError(errorMessage, module);
+                    throw new GeneralException(errorMessage);
+                }
             } catch (GenericServiceException e) {
                 Debug.logWarning(e, module);
                 throw new GeneralException("Error in authOrderPayments service: " + e.toString(), e.getNested());
@@ -1037,12 +1052,6 @@ public class CheckOutHelper {
             if (Debug.verboseOn()) {
                 Debug.logVerbose("Finished w/ Payment Service", module);
             }
-
-            if (paymentResult != null && ServiceUtil.isError(paymentResult)) {
-                throw new GeneralException(ServiceUtil.getErrorMessage(paymentResult));
-            }
-
-
             if (paymentResult != null && paymentResult.containsKey("processResult")) {
                 // grab the customer messages -- only passed back in the case of an error or failure
                 List<String> messages = UtilGenerics.checkList(paymentResult.get("authResultMsgs"));
@@ -1511,6 +1520,10 @@ public class CheckOutHelper {
         }
         try {
             Map<String, Object> res = dispatcher.runSync("calcBillingAccountBalance", UtilMisc.toMap("billingAccountId", billingAccountId));
+            if (ServiceUtil.isError(res)) {
+                Debug.logError(ServiceUtil.getErrorMessage(res), module);
+                return BigDecimal.ZERO;
+            }
             BigDecimal availableBalance = (BigDecimal) res.get("accountBalance");
             if (availableBalance != null) {
                 return availableBalance;
@@ -1661,6 +1674,9 @@ public class CheckOutHelper {
                     ctx.put("cardNumber", gc.getString("cardNumber"));
                     ctx.put("pinNumber", gc.getString("pinNumber"));
                     gcBalanceMap = dispatcher.runSync("checkGiftCertificateBalance", ctx);
+                    if (ServiceUtil.isError(gcBalanceMap)) {
+                        Debug.logError(ServiceUtil.getErrorMessage(gcBalanceMap), module);
+                    }
                 }
                 if ("valuelink".equalsIgnoreCase(giftCardType)) {
                     balanceField = "balance";
@@ -1668,6 +1684,9 @@ public class CheckOutHelper {
                     ctx.put("cardNumber", gc.getString("cardNumber"));
                     ctx.put("pin", gc.getString("pinNumber"));
                     gcBalanceMap = dispatcher.runSync("balanceInquireGiftCard", ctx);
+                    if (ServiceUtil.isError(gcBalanceMap)) {
+                        Debug.logError(ServiceUtil.getErrorMessage(gcBalanceMap), module);
+                    }
                 }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Sun Dec 31 11:11:46 2017
@@ -479,6 +479,10 @@ public class ShoppingCart implements Ite
                                     "quantity", quantity);
         try {
             Map<String, Object> result = dispatcher.runSync("getSuppliersForProduct", params);
+            if (ServiceUtil.isError(result)) {
+                Debug.logError(ServiceUtil.getErrorMessage(result), module);
+                return null;
+            }
             List<GenericValue> productSuppliers = UtilGenerics.checkList(result.get("supplierProducts"));
             if ((productSuppliers != null) && (productSuppliers.size() > 0)) {
                 supplierProduct = productSuppliers.get(0);
@@ -4251,6 +4255,11 @@ public class ShoppingCart implements Ite
 
                         // Get ATP for the product
                         Map<String, Object> getProductInventoryAvailableResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId));
+                        if (ServiceUtil.isError(getProductInventoryAvailableResult)) {
+                            String errorMessage = ServiceUtil.getErrorMessage(getProductInventoryAvailableResult);
+                            Debug.logError(errorMessage, module);
+                            return;
+                        }
                         BigDecimal availableToPromise = (BigDecimal) getProductInventoryAvailableResult.get("availableToPromiseTotal");
 
                         if (itemQuantity.compareTo(availableToPromise) <= 0) {
@@ -4276,6 +4285,11 @@ public class ShoppingCart implements Ite
                 String supplierPartyId = null;
                 try {
                     Map<String, Object> getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct", UtilMisc.<String, Object>toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId", getCurrency()));
+                    if (ServiceUtil.isError(getSuppliersForProductResult)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(getSuppliersForProductResult);
+                        Debug.logError(errorMessage, module);
+                        return;
+                    }
                     List<GenericValue> supplierProducts = UtilGenerics.checkList(getSuppliersForProductResult.get("supplierProducts"));
 
                     // Order suppliers by supplierPrefOrderId so that preferred suppliers are used first

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sun Dec 31 11:11:46 2017
@@ -1384,6 +1384,12 @@ public class ShoppingCartEvents {
             Map<String, Object> outMap = dispatcher.runSync("loadCartFromShoppingList",
                     UtilMisc.<String, Object>toMap("shoppingListId", shoppingListId,
                     "userLogin", userLogin));
+            if (ServiceUtil.isError(outMap)) {
+                String errorMessage = ServiceUtil.getErrorMessage(outMap);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
+                return "error";
+            }
             cart = (ShoppingCart)outMap.get("shoppingCart");
         } catch (GenericServiceException exc) {
             request.setAttribute("_ERROR_MESSAGE_", exc.getMessage());
@@ -1413,7 +1419,9 @@ public class ShoppingCartEvents {
                             "applyQuoteAdjustments", "true",
                             "userLogin", userLogin));
             if (ServiceUtil.isError(outMap)) {
-                request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(outMap));
+                String errorMessage = ServiceUtil.getErrorMessage(outMap);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
                 return "error";
             }
             cart = (ShoppingCart) outMap.get("shoppingCart");
@@ -1452,10 +1460,11 @@ public class ShoppingCartEvents {
                                                         "skipProductChecks", Boolean.TRUE, // the products have already been checked in the order, no need to check their validity again
                                                         "userLogin", userLogin));
             if (ServiceUtil.isError(outMap)) {
-                request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(outMap));
+                String errorMessage = ServiceUtil.getErrorMessage(outMap);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
                 return "error";
-             }
-
+            }
             cart = (ShoppingCart) outMap.get("shoppingCart");
 
             cart.removeAdjustmentByType("SALES_TAX");
@@ -1535,8 +1544,10 @@ public class ShoppingCartEvents {
             return "error";
         }
         if (ServiceUtil.isError(result)) {
-           request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result));
-           return "error";
+            String errorMessage = ServiceUtil.getErrorMessage(result);
+            request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+            Debug.logError(errorMessage, module);
+            return "error";
         }
         request.setAttribute("quoteId", quoteId);
         if (destroyCart != null && "Y".equals(destroyCart)) {
@@ -1565,8 +1576,10 @@ public class ShoppingCartEvents {
             return "error";
         }
         if (ServiceUtil.isError(result)) {
-           request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result));
-           return "error";
+            String errorMessage = ServiceUtil.getErrorMessage(result);
+            request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+            Debug.logError(errorMessage, module);
+            return "error";
         }
         request.setAttribute("custRequestId", custRequestId);
         if (destroyCart != null && "Y".equals(destroyCart)) {
@@ -2079,6 +2092,12 @@ public class ShoppingCartEvents {
                     appendOrderItemMap.put("shipGroupSeqId", shipGroupSeqId);
                     try {
                         Map<String, Object> result = dispatcher.runSync("appendOrderItem", appendOrderItemMap);
+                        if (ServiceUtil.isError(result)) {
+                            String errorMessage = ServiceUtil.getErrorMessage(result);
+                            request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                            Debug.logError(errorMessage, module);
+                            return "error";
+                        }
                         request.setAttribute("shoppingCart", result.get("shoppingCart"));
                         ShoppingCartEvents.destroyCart(request, response);
                     } catch (GenericServiceException e) {

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java Sun Dec 31 11:11:46 2017
@@ -983,8 +983,9 @@ public class ShoppingCartItem implements
         try {
             Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailableOrNotRequired", UtilMisc.<String, Object>toMap("productStoreId", productStoreId, "productId", productId, "product", this.getProduct(), "quantity", quantity));
             if (ServiceUtil.isError(invReqResult)) {
-                Debug.logError("Error calling isStoreInventoryAvailableOrNotRequired service, result is: " + invReqResult, module);
-                throw new CartItemModifyException((String) invReqResult.get(ModelService.ERROR_MESSAGE));
+                String errorMessage = ServiceUtil.getErrorMessage(invReqResult);
+                Debug.logError(errorMessage, module);
+                throw new CartItemModifyException(errorMessage);
             }
             inventoryAvailable = "Y".equals(invReqResult.get("availableOrNotRequired"));
         } catch (GenericServiceException e) {
@@ -1089,6 +1090,8 @@ public class ShoppingCartItem implements
                     priceContext.put("currencyUomId", cart.getCurrency());
                     Map<String, Object> priceResult = dispatcher.runSync("calculatePurchasePrice", priceContext);
                     if (ServiceUtil.isError(priceResult)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(priceResult);
+                        Debug.logError(errorMessage, module);
                         throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));
                     }
                     Boolean validPriceFound = (Boolean) priceResult.get("validPriceFound");
@@ -1141,9 +1144,10 @@ public class ShoppingCartItem implements
 
                     Map<String, Object> priceResult = dispatcher.runSync("calculateProductPrice", priceContext);
                     if (ServiceUtil.isError(priceResult)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(priceResult);
+                        Debug.logError(errorMessage, module);
                         throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));
                     }
-
                     Boolean validPriceFound = (Boolean) priceResult.get("validPriceFound");
                     if (Boolean.FALSE.equals(validPriceFound)) {
                         throw new CartItemModifyException("Could not find a valid price for the product with ID [" + this.getProductId() + "], not adding to cart.");
@@ -1195,6 +1199,11 @@ public class ShoppingCartItem implements
                             BigDecimal totalPrice = configWrapper.getTotalPrice();
                             // Get Taxes
                             Map<String, Object> totalPriceWithTaxMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPrice, "productId", this.productId, "productStoreId", cart.getProductStoreId()));
+                            if (ServiceUtil.isError(totalPriceWithTaxMap)) {
+                                String errorMessage = ServiceUtil.getErrorMessage(totalPriceWithTaxMap);
+                                Debug.logError(errorMessage, module);
+                                throw new CartItemModifyException("There was an error while calculating tax: " + ServiceUtil.getErrorMessage(priceResult));
+                            }
                             this.setDisplayPrice((BigDecimal) totalPriceWithTaxMap.get("priceWithTax"));
                         } else {
                             this.setDisplayPrice(configWrapper.getTotalPrice());
@@ -1207,9 +1216,10 @@ public class ShoppingCartItem implements
                     recurringPriceContext.put("productPricePurposeId", "RECURRING_CHARGE");
                     Map<String, Object> recurringPriceResult = dispatcher.runSync("calculateProductPrice", recurringPriceContext);
                     if (ServiceUtil.isError(recurringPriceResult)) {
-                        throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(recurringPriceResult));
+                        String errorMessage = ServiceUtil.getErrorMessage(recurringPriceResult);
+                        Debug.logError(errorMessage, module);
+                        throw new CartItemModifyException("There was an error while calculating price: " + ServiceUtil.getErrorMessage(priceResult));
                     }
-
                     // for the recurring price only set the values iff validPriceFound is true
                     Boolean validRecurringPriceFound = (Boolean) recurringPriceResult.get("validPriceFound");
                     if (Boolean.TRUE.equals(validRecurringPriceFound)) {
@@ -1830,6 +1840,10 @@ public class ShoppingCartItem implements
        if (UtilValidate.isNotEmpty(featureAppls)) {
            try {
               Map<String, Object> result = dispatcher.runSync("convertFeaturesForSupplier", UtilMisc.toMap("partyId", partyId, "productFeatures", featureAppls));
+              if (ServiceUtil.isError(result)) {
+                  String errorMessage = ServiceUtil.getErrorMessage(result);
+                  Debug.logError(errorMessage, module);
+              }
               featuresForSupplier = UtilGenerics.checkList(result.get("convertedProductFeatures"));
            } catch (GenericServiceException e) {
                Debug.logError(e, "Unable to get features for supplier from product : " + this.productId, module);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java Sun Dec 31 11:11:46 2017
@@ -390,6 +390,9 @@ public class ShoppingCartServices {
                             surveyResponseMap.put("answers", answers);
                             surveyResponseMap.put("surveyId", surveyId);
                             surveyResponseResult = dispatcher.runSync("createSurveyResponse", surveyResponseMap);
+                            if (ServiceUtil.isError(surveyResponseResult)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(surveyResponseResult));
+                            }
                         }
                     }
                 } catch (GenericEntityException | GenericServiceException e) {

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sun Dec 31 11:11:46 2017
@@ -1439,7 +1439,7 @@ public final class ProductPromoWorker {
             }
             if (ServiceUtil.isError(actionResult)) {
                 Debug.logError("Error calling promo action service [" + serviceName + "], result is: " + actionResult, module);
-                throw new CartItemModifyException((String) actionResult.get(ModelService.ERROR_MESSAGE));
+                throw new CartItemModifyException(ServiceUtil.getErrorMessage(actionResult));
             }
             CartItemModifyException cartItemModifyException = (CartItemModifyException) actionResult.get("cartItemModifyException");
             if (cartItemModifyException != null) {
@@ -1506,7 +1506,7 @@ public final class ProductPromoWorker {
                             Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.<String, Object>toMap("productStoreId", productStoreId, "productId", productId, "product", product, "quantity", quantity.add(quantityAlreadyInCart)));
                             if (ServiceUtil.isError(invReqResult)) {
                                 Debug.logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult, module);
-                                throw new CartItemModifyException((String) invReqResult.get(ModelService.ERROR_MESSAGE));
+                                throw new CartItemModifyException(ServiceUtil.getErrorMessage(invReqResult));
                             } else if (!"Y".equals(invReqResult.get("available"))) {
                                 Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderNotApplyingGwpBecauseProductIdIsOutOfStockForProductPromoAction", UtilMisc.toMap("productId", productId, "productPromoAction", productPromoAction), cart.getLocale()), module);
                                 productId = null;
@@ -1540,7 +1540,7 @@ public final class ProductPromoWorker {
                         Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.<String, Object>toMap("productStoreId", productStoreId, "productId", optionProductId, "product", product, "quantity", quantity.add(quantityAlreadyInCart)));
                         if (ServiceUtil.isError(invReqResult)) {
                             Debug.logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult, module);
-                            throw new CartItemModifyException((String) invReqResult.get(ModelService.ERROR_MESSAGE));
+                            throw new CartItemModifyException(ServiceUtil.getErrorMessage(invReqResult));
                         } else if (!"Y".equals(invReqResult.get("available"))) {
                             optionProductIdIter.remove();
                         }

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java Sun Dec 31 11:11:46 2017
@@ -105,17 +105,16 @@ public class ShoppingListEvents {
             Map<String, Object> newListResult = null;
             try {
                 newListResult = dispatcher.runSync("createShoppingList", UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", cart.getProductStoreId(), "partyId", cart.getOrderPartyId(), "shoppingListTypeId", shoppingListTypeId, "currencyUom", cart.getCurrency()));
+                if (ServiceUtil.isError(newListResult)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(newListResult);
+                    Debug.logError(errorMessage, module);
+                    throw new IllegalArgumentException(errorMessage);
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, "Problems creating new ShoppingList", module);
                 errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.cannot_create_new_shopping_list", cart.getLocale());
                 throw new IllegalArgumentException(errMsg);
             }
-
-            // check for errors
-            if (ServiceUtil.isError(newListResult)) {
-                throw new IllegalArgumentException(ServiceUtil.getErrorMessage(newListResult));
-            }
-
             // get the new list id
             if (newListResult != null) {
                 shoppingListId = (String) newListResult.get("shoppingListId");
@@ -156,16 +155,16 @@ public class ShoppingListEvents {
                             ctx.put("configId", item.getConfigWrapper().getConfigId());
                         }
                         serviceResult = dispatcher.runSync("createShoppingListItem", ctx);
+                        if (ServiceUtil.isError(serviceResult)) {
+                            String errorMessage = ServiceUtil.getErrorMessage(serviceResult);
+                            Debug.logError(errorMessage, module);
+                            throw new IllegalArgumentException(errorMessage);
+                        }
                     } catch (GenericServiceException e) {
                         Debug.logError(e, "Problems creating ShoppingList item entity", module);
                         errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.error_adding_item_to_shopping_list", cart.getLocale());
                         throw new IllegalArgumentException(errMsg);
                     }
-
-                    // check for errors
-                    if (ServiceUtil.isError(serviceResult)) {
-                        throw new IllegalArgumentException(ServiceUtil.getErrorMessage(serviceResult));
-                    }
                 }
             }
         }
@@ -335,6 +334,12 @@ public class ShoppingListEvents {
         Map<String, Object> result = null;
         try {
             result = dispatcher.runSync("updateShoppingListItem", serviceInMap);
+            if (ServiceUtil.isError(result)) {
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
+                return "error";
+            }
         } catch (GenericServiceException e) {
             String errMsg = UtilProperties.getMessage(resource_error,"shoppingListEvents.error_calling_update", locale) + ": "  + e.toString();
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
@@ -342,11 +347,6 @@ public class ShoppingListEvents {
             Debug.logError(e, errorMsg, module);
             return "error";
         }
-
-        ServiceUtil.getMessages(request, result, "", "", "", "", "", "", "");
-        if ("error".equals(result.get(ModelService.RESPONSE_MESSAGE))) {
-            return "error";
-        }
         return "success";
     }
 
@@ -374,7 +374,11 @@ public class ShoppingListEvents {
         if (list == null && dispatcher != null) {
             Map<String, Object> listFields = UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", productStoreId, "shoppingListTypeId", "SLT_SPEC_PURP", "listName", PERSISTANT_LIST_NAME);
             Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields);
-
+            if (ServiceUtil.isError(newListResult)) {
+                String errorMessage = ServiceUtil.getErrorMessage(newListResult);
+                Debug.logError(errorMessage, module);
+                return null;
+            }
             if (newListResult != null) {
                 autoSaveListId = (String) newListResult.get("shoppingListId");
             }
@@ -651,6 +655,11 @@ public class ShoppingListEvents {
                 try {
                     Map<String, Object> listFields = UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", productStoreId, "shoppingListTypeId", "SLT_SPEC_PURP", "listName", PERSISTANT_LIST_NAME);
                     Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields);
+                    if (ServiceUtil.isError(newListResult)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(newListResult);
+                        Debug.logError(errorMessage, module);
+                        return null;
+                    }
                     if (newListResult != null) {
                         autoSaveListId = (String) newListResult.get("shoppingListId");
                     }

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java Sun Dec 31 11:11:46 2017
@@ -581,6 +581,7 @@ public class ShoppingListServices {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         List<GenericValue> shoppingList = null;
+        Map<String, Object> result = new HashMap<String, Object>();
         try {
             shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("partyId", null, "shoppingListTypeId", "SLT_SPEC_PURP").queryList();
         } catch (GenericEntityException e) {
@@ -613,15 +614,21 @@ public class ShoppingListServices {
                     }
                     for (GenericValue sli : shoppingListItems) {
                         try {
-                            dispatcher.runSync("removeShoppingListItem", UtilMisc.toMap("shoppingListId", sl.getString("shoppingListId"),
+                            result = dispatcher.runSync("removeShoppingListItem", UtilMisc.toMap("shoppingListId", sl.getString("shoppingListId"),
                                     "shoppingListItemSeqId", sli.getString("shoppingListItemSeqId"),
                                     "userLogin", userLogin));
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                         } catch (GenericServiceException e) {
                             Debug.logError(e.getMessage(), module);
                         }
                     }
                     try {
-                        dispatcher.runSync("removeShoppingList", UtilMisc.toMap("shoppingListId", sl.getString("shoppingListId"), "userLogin", userLogin));
+                        result = dispatcher.runSync("removeShoppingList", UtilMisc.toMap("shoppingListId", sl.getString("shoppingListId"), "userLogin", userLogin));
+                        if (ServiceUtil.isError(result)) {
+                            return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                        }
                     } catch (GenericServiceException e) {
                         Debug.logError(e.getMessage(), module);
                     }

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java Sun Dec 31 11:11:46 2017
@@ -34,7 +34,7 @@ import org.apache.ofbiz.base.util.UtilPr
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.service.GenericServiceException;
 import org.apache.ofbiz.service.LocalDispatcher;
-import org.apache.ofbiz.service.ModelService;
+import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.webapp.control.ConfigXMLReader.Event;
 import org.apache.ofbiz.webapp.control.RequestHandler;
 import org.apache.ofbiz.webapp.event.EventHandler;
@@ -73,8 +73,10 @@ public class TaskEvents {
             Map<String, ? extends Object> context = UtilMisc.toMap("workEffortId", workEffortId, "partyId", partyId, "roleTypeId", roleTypeId,
                     "fromDate", fromDate, "result", parameterMap, "userLogin", userLogin);
             result = dispatcher.runSync("wfCompleteAssignment", context);
-            if (result.containsKey(ModelService.RESPOND_ERROR)) {
-                request.setAttribute("_ERROR_MESSAGE_", result.get(ModelService.ERROR_MESSAGE));
+            if (ServiceUtil.isError(result)) {
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
                 return "error";
             }
         } catch (GenericServiceException e) {
@@ -134,6 +136,12 @@ public class TaskEvents {
         Map<String, Object> result = null;
         try {
             result = dispatcher.runSync("addOrderRole", context);
+            if (ServiceUtil.isError(result)) {
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
+                return false;
+            }
             Debug.logInfo("Added user to order role " + result, module);
         } catch (GenericServiceException gse) {
             request.setAttribute("_ERROR_MESSAGE_", gse.getMessage());

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java Sun Dec 31 11:11:46 2017
@@ -60,6 +60,9 @@ public class OrderTestServices {
             try {
                 ModelService modelService = dctx.getModelService("createTestSalesOrderSingle");
                 Map<String, Object> outputMap = dispatcher.runSync("createTestSalesOrderSingle", modelService.makeValid(context, ModelService.IN_PARAM));
+                if (ServiceUtil.isError(outputMap)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap));
+                }
                 String orderId = (String)outputMap.get("orderId");
                 Debug.logInfo("Test sales order with id [" + orderId + "] has been processed.", module);
             } catch (GenericServiceException e) {
@@ -93,6 +96,9 @@ public class OrderTestServices {
                 numberOfProductsPerOrder = 1;
             } else {
                 Map<String, Object> result = dispatcher.runSync("getProductCategoryMembers", UtilMisc.toMap("categoryId", productCategoryId));
+                if (ServiceUtil.isError(result)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                }
                 if (result.get("categoryMembers") != null) {
                     List<GenericValue> productCategoryMembers = UtilGenerics.checkList(result.get("categoryMembers"));
                     if (productCategoryMembers != null) {
@@ -159,7 +165,10 @@ public class OrderTestServices {
         Boolean shipOrder = (Boolean) context.get("shipOrder");
         if (shipOrder.booleanValue() && UtilValidate.isNotEmpty(orderId)) {
             try {
-                dispatcher.runSync("quickShipEntireOrder", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin));
+                Map<String, Object> result = dispatcher.runSync("quickShipEntireOrder", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin));
+                if (ServiceUtil.isError(result)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                }
                 Debug.logInfo("Test sales order with id [" + orderId + "] has been shipped", module);
             } catch (GenericServiceException gse) {
                 Debug.logWarning("Unable to quick ship test sales order with id [" + orderId + "] with error: " + gse.getMessage(), module);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java Sun Dec 31 11:11:46 2017
@@ -24,12 +24,15 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
+import org.apache.ofbiz.service.ServiceUtil;
 
 public class PurchaseOrderTest extends OFBizTestCase {
+    public static final String module = OFBizTestCase.class.getName();
 
     protected GenericValue userLogin = null;
     protected String orderId = null;
@@ -93,6 +96,10 @@ public class PurchaseOrderTest extends O
         ctx.put("userLogin", userLogin);
 
         Map <String, Object> resp = dispatcher.runSync("storeOrder", ctx);
+        if (ServiceUtil.isError(resp)) {
+            Debug.logError(ServiceUtil.getErrorMessage(resp), module);
+            return;
+        }
         orderId = (String) resp.get("orderId");
         statusId = (String) resp.get("statusId");
         assertNotNull(orderId);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java Sun Dec 31 11:11:46 2017
@@ -23,12 +23,15 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityQuery;
+import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
 
 public class SalesOrderTest extends OFBizTestCase {
+    public static final String module = OFBizTestCase.class.getName();
 
     protected GenericValue userLogin = null;
 
@@ -140,6 +143,10 @@ public class SalesOrderTest extends OFBi
 
         ctx.put("userLogin", userLogin);
         Map<String, Object> resp = dispatcher.runSync("storeOrder", ctx);
+        if (ServiceUtil.isError(resp)) {
+            Debug.logError(ServiceUtil.getErrorMessage(resp), module);
+            return;
+        }
         String orderId = (String) resp.get("orderId");
         String statusId = (String) resp.get("statusId");
         assertNotNull(orderId);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun Dec 31 11:11:46 2017
@@ -72,8 +72,9 @@ public class ExpressCheckoutEvents {
                 return "error";
             }
             if (ServiceUtil.isError(result)) {
-                Debug.logError(ServiceUtil.getErrorMessage(result), module);
-                request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resourceErr, "AccountingPayPalCommunicationError", locale));
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
                 return "error";
             }
         }
@@ -129,7 +130,13 @@ public class ExpressCheckoutEvents {
             inMap.put("request", request);
             inMap.put("response", response);
             try {
-                dispatcher.runSync("payPalCheckoutUpdate", inMap);
+                Map<String, Object> result = dispatcher.runSync("payPalCheckoutUpdate", inMap);
+                if (ServiceUtil.isError(result)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(result);
+                    request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                    Debug.logError(errorMessage, module);
+                    return "error";
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
             }
@@ -159,8 +166,9 @@ public class ExpressCheckoutEvents {
                 return "error";
             }
             if (ServiceUtil.isError(result)) {
-                Debug.logError(ServiceUtil.getErrorMessage(result), module);
-                request.setAttribute("_EVENT_MESSAGE_", ServiceUtil.getErrorMessage(result));
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                request.setAttribute("_ERROR_MESSAGE_", errorMessage);
+                Debug.logError(errorMessage, module);
                 return "error";
             }
         }
@@ -183,6 +191,9 @@ public class ExpressCheckoutEvents {
             Map<String, Object> result = null;
             try {
                 result = dispatcher.runSync(serviceName, inMap);
+                if (ServiceUtil.isError(result)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                }
             } catch (GenericServiceException e) {
                 return ServiceUtil.returnError(e.getMessage());
             }

Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java Sun Dec 31 11:11:46 2017
@@ -203,8 +203,14 @@ public class CommunicationEventServices
                 Map<String, Object> tmpResult = null;
                 if (isMultiPart) {
                     tmpResult = dispatcher.runSync("sendMailMultiPart", sendMailParams, 360, true);
+                    if (ServiceUtil.isError(tmpResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
+                    }
                 } else {
                     tmpResult = dispatcher.runSync("sendMail", sendMailParams, 360, true);
+                    if (ServiceUtil.isError(tmpResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
+                    }
                 }
 
                 if (ServiceUtil.isError(tmpResult)) {
@@ -401,6 +407,9 @@ public class CommunicationEventServices
                                         sendMailParams.put("bodyParameters", bodyParameters);
                                         sendMailParams.remove("body");
                                         tmpResult = dispatcher.runSync("sendMailFromScreen", sendMailParams, 360, true);
+                                        if (ServiceUtil.isError(tmpResult)) {
+                                            return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
+                                        }
                                     }
                                 }
                             }
@@ -410,6 +419,9 @@ public class CommunicationEventServices
                         if (UtilValidate.isEmpty(tmpResult)) {
                             sendMailParams.put("body", communicationEvent.getString("content"));
                             tmpResult = dispatcher.runSync("sendMail", sendMailParams, 360, true);
+                            if (ServiceUtil.isError(tmpResult)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
+                            }
                         }
 
                         if (tmpResult == null || ServiceUtil.isError(tmpResult)) {
@@ -586,6 +598,9 @@ public class CommunicationEventServices
         Map<String, Object> createResult;
         try {
             createResult = dispatcher.runSync("createCommunicationEvent", commEventMap);
+            if (ServiceUtil.isError(createResult)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createResult));
+            }
         } catch (GenericServiceException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
@@ -627,7 +642,10 @@ public class CommunicationEventServices
 
         // save the communication event
         try {
-            dispatcher.runSync("updateCommunicationEvent", commEventMap);
+            Map<String, Object> result = dispatcher.runSync("updateCommunicationEvent", commEventMap);
+            if (ServiceUtil.isError(result)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+            }
         } catch (GenericServiceException e) {
             return ServiceUtil.returnError(e.getMessage());
         }
@@ -758,6 +776,9 @@ public class CommunicationEventServices
             // if partyIdTo not found try to find the "to" address using the delivered-to header
             if ((partyIdTo == null) && (deliveredTo != null)) {
                 result = dispatcher.runSync("findPartyFromEmailAddress", UtilMisc.<String, Object>toMap("address", deliveredTo, "userLogin", userLogin));
+                if (ServiceUtil.isError(result)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                }
                 partyIdTo = (String)result.get("partyId");
                 contactMechIdTo = (String)result.get("contactMechId");
             }
@@ -886,6 +907,9 @@ public class CommunicationEventServices
             commEventMap.put("headerString", header.replaceAll("[<>]", ""));
 
             result = dispatcher.runSync("createCommunicationEvent", commEventMap);
+            if (ServiceUtil.isError(result)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+            }
             communicationEventId = (String)result.get("communicationEventId");
             Debug.logInfo("Persisting New Email: " + aboutThisEmail + " into CommunicationEventId: " + communicationEventId, module);
 
@@ -1032,7 +1056,12 @@ public class CommunicationEventServices
                 }
 
                 // save the content
-                dispatcher.runSync("createCommContentDataResource", attachmentMap);
+                Map<String, Object> result = dispatcher.runSync("createCommContentDataResource", attachmentMap);
+                if (ServiceUtil.isError(result)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(result);
+                    Debug.logError(errorMessage, module);
+                    throw new GenericServiceException(errorMessage);
+                }
             }
         }
     }
@@ -1051,7 +1080,11 @@ public class CommunicationEventServices
                             "partyId", partyId, "roleTypeId", roleTypeId, "userLogin", userLogin,
                             "contactMechId", (String) result.get("contactMechId"),
                             "statusId", "COM_ROLE_CREATED");
-                    dispatcher.runSync("createCommunicationEventRole", input);
+                    Map<String, Object> resultMap = dispatcher.runSync("createCommunicationEventRole", input);
+                    if (ServiceUtil.isError(resultMap)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+                        Debug.logError(errorMessage, module);
+                    }
                 }
             }
         } catch (GenericServiceException | GenericEntityException e) {
@@ -1064,7 +1097,11 @@ public class CommunicationEventServices
         try {
             for (Map<String, Object> result : workEffortInfos) {
                 String workEffortId = (String) result.get("workEffortId");
-                dispatcher.runSync("createCommunicationEventWorkEff", UtilMisc.toMap("workEffortId", workEffortId, "communicationEventId", communicationEventId, "userLogin", userLogin));
+                Map<String, Object> resultMap = dispatcher.runSync("createCommunicationEventWorkEff", UtilMisc.toMap("workEffortId", workEffortId, "communicationEventId", communicationEventId, "userLogin", userLogin));
+                if (ServiceUtil.isError(resultMap)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(resultMap);
+                    Debug.logError(errorMessage, module);
+                }
             }
         } catch (GenericServiceException e) {
             Debug.logError(e, module);
@@ -1095,6 +1132,11 @@ public class CommunicationEventServices
             map.put("address", emailAddress.getAddress());
             map.put("userLogin", userLogin);
             result = dispatcher.runSync("findPartyFromEmailAddress", map);
+            if (ServiceUtil.isError(result)) {
+                String errorMessage = ServiceUtil.getErrorMessage(result);
+                Debug.logError(errorMessage, module);
+                throw new GenericServiceException(errorMessage);
+            }
         }
 
         return result;
@@ -1115,6 +1157,11 @@ public class CommunicationEventServices
 
                     result = dispatcher.runSync("findPartyFromEmailAddress",
                             UtilMisc.toMap("address", emailAddress.getAddress(), "userLogin", userLogin));
+                    if (ServiceUtil.isError(result)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(result);
+                        Debug.logError(errorMessage, module);
+                        throw new GenericServiceException(errorMessage);
+                    }
                     if (result.get("partyId") != null) {
                         tempResults.add(result);
                     }
@@ -1143,6 +1190,11 @@ public class CommunicationEventServices
                     inputFields.put("infoString_ic", caseInsensitiveEmail);
                     result = dispatcher.runSync("performFind", UtilMisc.<String, Object>toMap("entityName",
                             "WorkEffortContactMechView", "inputFields", inputFields, "userLogin", userLogin));
+                    if (ServiceUtil.isError(result)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(result);
+                        Debug.logError(errorMessage, module);
+                        throw new GenericServiceException(errorMessage);
+                    }
                     try (EntityListIterator listIt = (EntityListIterator) result.get("listIt")) {
                         List<GenericValue> list = listIt.getCompleteList();
                         List<GenericValue> filteredList = EntityUtil.filterByDate(list);
@@ -1232,6 +1284,10 @@ public class CommunicationEventServices
                             Map<String, Object> result;
                             try {
                                 result = dispatcher.runSync("updateCommunicationEvent", updateCtx);
+                                if (ServiceUtil.isError(result)) {
+                                    String errorMessage = ServiceUtil.getErrorMessage(result);
+                                    Debug.logError(errorMessage, module);
+                                }
                             } catch (GenericServiceException e) {
                                 Debug.logError(e, module);
                                 return ServiceUtil.returnError(e.getMessage());

Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java Sun Dec 31 11:11:46 2017
@@ -911,7 +911,7 @@ public class ContactMechServices {
             try {
                 Map<String, Object> deletePcmResult = ctx.getDispatcher().runSync("deletePartyContactMechPurpose", deletePcmCtx);
                 if (ServiceUtil.isError(deletePcmResult)) {
-                    return deletePcmResult;
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(deletePcmResult));
                 }
             } catch (GenericServiceException e) {
                 Debug.logWarning(e.getMessage(), module);
@@ -1037,7 +1037,7 @@ public class ContactMechServices {
                             "contactMechId", contactMechId, "contactMechTypeId", contactMech.getString("contactMechTypeId"), "fromDate", UtilDateTime.nowTimestamp(),
                             "allowSolicitation", partyContactMech.getString("allowSolicitation"), "extension", partyContactMech.getString("extension")));
                 if (ServiceUtil.isError(serviceResults)) {
-                    return serviceResults;
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
                 }
 
                 // loop through purposes and copy each as a new purpose for the partyIdTo
@@ -1046,7 +1046,7 @@ public class ContactMechServices {
                     input.put("contactMechPurposeTypeId", purpose.getString("contactMechPurposeTypeId"));
                     serviceResults = dispatcher.runSync("createPartyContactMechPurpose", input);
                     if (ServiceUtil.isError(serviceResults)) {
-                        return serviceResults;
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
                     }
                 }
             }

Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java Sun Dec 31 11:11:46 2017
@@ -151,7 +151,10 @@ public class PartyRelationshipServices {
                         oldPartyRelationShip.store();
                 }
                 try {
-                    dispatcher.runSync("createPartyRelationship", context); // Create new one
+                    Map<String, Object> resultMap = dispatcher.runSync("createPartyRelationship", context); // Create new one
+                    if (ServiceUtil.isError(resultMap)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
+                    }
                 } catch (GenericServiceException e) {
                     Debug.logWarning(e.getMessage(), module);
                     return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,

Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java Sun Dec 31 11:11:46 2017
@@ -309,7 +309,10 @@ public class PartyServices {
 
         if (UtilValidate.isNotEmpty(context.get("statusId")) && !context.get("statusId").equals(oldStatusId)) {
             try {
-                dispatcher.runSync("setPartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", context.get("statusId"), "userLogin", context.get("userLogin")));
+                Map<String, Object> serviceResult = dispatcher.runSync("setPartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", context.get("statusId"), "userLogin", context.get("userLogin")));
+                if (ServiceUtil.isError(serviceResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logWarning(e.getMessage(), module);
                 return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -488,7 +491,10 @@ public class PartyServices {
 
         if (UtilValidate.isNotEmpty(context.get("statusId")) && !context.get("statusId").equals(oldStatusId)) {
             try {
-                dispatcher.runSync("setPartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", context.get("statusId"), "userLogin", context.get("userLogin")));
+                Map<String, Object> serviceResult = dispatcher.runSync("setPartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", context.get("statusId"), "userLogin", context.get("userLogin")));
+                if (ServiceUtil.isError(serviceResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logWarning(e.getMessage(), module);
                 return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -656,6 +662,9 @@ public class PartyServices {
             try {
                 noteRes = dispatcher.runSync("createNote", UtilMisc.toMap("partyId", userLogin.getString("partyId"),
                          "note", noteString, "userLogin", userLogin, "locale", locale, "noteName", noteName));
+                if (ServiceUtil.isError(noteRes)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(noteRes));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, e.getMessage(), module);
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -2122,6 +2131,9 @@ public class PartyServices {
                                         "userLogin", userLogin
                                         );
                                 result = dispatcher.runSync("updatePartyGroup", partyGroup);
+                                if (ServiceUtil.isError(result)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                }
                             } else { // person
                                 Map<String, Object> person = UtilMisc.toMap(
                                         "partyId", newPartyId,
@@ -2132,6 +2144,9 @@ public class PartyServices {
                                         "userLogin", userLogin
                                         );
                                 result = dispatcher.runSync("updatePerson", person);
+                                if (ServiceUtil.isError(result)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                }
                             }
 
                         } else { // create new party
@@ -2143,6 +2158,9 @@ public class PartyServices {
                                         "statusId", "PARTY_ENABLED"
                                         );
                                 result = dispatcher.runSync("createPartyGroup", partyGroup);
+                                if (ServiceUtil.isError(result)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                }
                             } else { // person
                                 Map<String, Object> person = UtilMisc.toMap(
                                         "firstName", rec.get("firstName"),
@@ -2153,6 +2171,9 @@ public class PartyServices {
                                         "userLogin", userLogin
                                         );
                                 result = dispatcher.runSync("createPerson", person);
+                                if (ServiceUtil.isError(result)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                }
                             }
                             newPartyId = (String) result.get("partyId");
 
@@ -2164,6 +2185,9 @@ public class PartyServices {
                                 );
 
                             result = dispatcher.runSync("createPartyIdentification", partyIdentification);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
 
                             Map<String, Object> partyRole = UtilMisc.toMap(
                                     "partyId", newPartyId,
@@ -2171,6 +2195,9 @@ public class PartyServices {
                                     "userLogin", userLogin
                                     );
                             dispatcher.runSync("createPartyRole", partyRole);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
 
                             if (UtilValidate.isNotEmpty(rec.get("companyPartyId"))) {
                                 List <GenericValue> companyCheck = EntityQuery.use(delegator).from("PartyIdentification")
@@ -2184,6 +2211,9 @@ public class PartyServices {
                                         "userLogin", userLogin
                                         );
                                     result = dispatcher.runSync("createPartyGroup", companyPartyGroup);
+                                    if (ServiceUtil.isError(result)) {
+                                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                    }
                                     newCompanyPartyId = (String) result.get("partyId");
                                 } else {
                                     newCompanyPartyId = EntityUtil.getFirst(companyCheck).getString("partyId");
@@ -2194,7 +2224,10 @@ public class PartyServices {
                                         "roleTypeId", "ACCOUNT",
                                         "userLogin", userLogin
                                         );
-                                dispatcher.runSync("createPartyRole", companyRole);
+                                Map<String, Object> serviceResult = dispatcher.runSync("createPartyRole", companyRole);
+                                if (ServiceUtil.isError(serviceResult)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                                }
 
                                 // company exist, so create link
                                 Map<String, Object> partyRelationship = UtilMisc.toMap(
@@ -2205,6 +2238,9 @@ public class PartyServices {
                                     "userLogin", userLogin
                                     );
                                 result = dispatcher.runSync("createPartyRelationship", partyRelationship);
+                                if (ServiceUtil.isError(result)) {
+                                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                                }
                             }
                         }
                         Debug.logInfo(" =========================================================party created id: " + newPartyId, module);
@@ -2284,34 +2320,55 @@ public class PartyServices {
 
                         if (postalAddressChanged) {
                             result = dispatcher.runSync("createPostalAddress", postalAddress);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                                newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
                                 currentContactMechPurposeTypeId = "GENERAL_LOCATION";
                             }
-                            dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            Map<String, Object> serviceResult = dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            if (ServiceUtil.isError(serviceResult)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                            }
                         }
 
                         if (telecomNumberChanged) {
                             result = dispatcher.runSync("createTelecomNumber", telecomNumber);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                                newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
                                 currentContactMechPurposeTypeId= "PHONE_WORK";
                             }
-                            dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            Map<String, Object> resultMap = dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                         }
 
                         if (emailAddressChanged) {
                             result = dispatcher.runSync("createContactMech", emailAddress);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                                newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
                                 currentContactMechPurposeTypeId = "PRIMARY_EMAIL";
                             }
-                            dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            Map<String, Object> resultMap = dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                         }
 
                         if (partyContactMechPurposeChanged) {
                             partyContactMechPurpose.put("contactMechId", newContactMechId);
                             result = dispatcher.runSync("createPartyContactMechPurpose", partyContactMechPurpose);
+                            if (ServiceUtil.isError(result)) {
+                                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                            }
                         }
                         lastPartyId = currentPartyId;
                         errMsgs.addAll(newErrMsgs);

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java Sun Dec 31 11:11:46 2017
@@ -31,6 +31,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.GeneralException;
 import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.entity.Delegator;
@@ -40,6 +41,7 @@ import org.apache.ofbiz.entity.GenericVa
 import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.service.ServiceContainer;
+import org.apache.ofbiz.service.ServiceUtil;
 
 /**
  * Product Config Wrapper: gets product config to display
@@ -112,6 +114,10 @@ public class ProductConfigWrapper implem
         Map<String, Object> priceContext = UtilMisc.toMap("product", product, "prodCatalogId", catalogId, "webSiteId", webSiteId, "productStoreId", productStoreId,
                                       "currencyUomId", currencyUomId, "autoUserLogin", autoUserLogin);
         Map<String, Object> priceMap = dispatcher.runSync("calculateProductPrice", priceContext);
+        if (ServiceUtil.isError(priceMap)) {
+            String errorMessage = ServiceUtil.getErrorMessage(priceMap);
+            throw new GeneralException(errorMessage);
+        }
         BigDecimal originalListPrice = (BigDecimal) priceMap.get("listPrice");
         BigDecimal price = (BigDecimal) priceMap.get("price");
         if (originalListPrice != null) {
@@ -573,6 +579,10 @@ public class ProductConfigWrapper implem
                 // Get the component's price
                 Map<String, Object> fieldMap = UtilMisc.toMap("product", oneComponent.getRelatedOne("ProductProduct", false), "prodCatalogId", catalogId, "webSiteId", webSiteId, "currencyUomId", currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", autoUserLogin, "productStoreId",productStoreId);
                 Map<String, Object> priceMap = dispatcher.runSync("calculateProductPrice", fieldMap);
+                if (ServiceUtil.isError(priceMap)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(priceMap);
+                    throw new GeneralException(errorMessage);
+                }
                 BigDecimal componentListPrice = (BigDecimal) priceMap.get("listPrice");
                 BigDecimal componentPrice = (BigDecimal) priceMap.get("price");
                 Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound");
@@ -593,6 +603,10 @@ public class ProductConfigWrapper implem
                 } else {
                     fieldMap.put("productPricePurposeId", "PURCHASE");
                     Map<String, Object> purchasePriceResultMap = dispatcher.runSync("calculateProductPrice", fieldMap);
+                    if (ServiceUtil.isError(purchasePriceResultMap)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(purchasePriceResultMap);
+                        throw new GeneralException(errorMessage);
+                    }
                     BigDecimal purchaseListPrice = (BigDecimal) purchasePriceResultMap.get("listPrice");
                     BigDecimal purchasePrice = (BigDecimal) purchasePriceResultMap.get("price");
                     if (purchaseListPrice != null) {
@@ -639,6 +653,11 @@ public class ProductConfigWrapper implem
                 // Get the component's price
                 Map<String, Object> fieldMap = UtilMisc.toMap("product", oneComponentProduct, "prodCatalogId", pcw.catalogId, "webSiteId", pcw.webSiteId, "currencyUomId", pcw.currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", pcw.autoUserLogin, "productStoreId",productStoreId);
                 Map<String, Object> priceMap = pcw.getDispatcher().runSync("calculateProductPrice", fieldMap);
+                Map<String, Object> purchasePriceResultMap = dispatcher.runSync("calculateProductPrice", fieldMap);
+                if (ServiceUtil.isError(purchasePriceResultMap)) {
+                    String errorMessage = ServiceUtil.getErrorMessage(purchasePriceResultMap);
+                    throw new GeneralException(errorMessage);
+                }
                 BigDecimal componentListPrice = (BigDecimal) priceMap.get("listPrice");
                 BigDecimal componentPrice = (BigDecimal) priceMap.get("price");
                 Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound");
@@ -658,7 +677,11 @@ public class ProductConfigWrapper implem
                     }
                 } else {
                     fieldMap.put("productPricePurposeId", "PURCHASE");
-                    Map<String, Object> purchasePriceResultMap = pcw.getDispatcher().runSync("calculateProductPrice", fieldMap);
+                    purchasePriceResultMap = pcw.getDispatcher().runSync("calculateProductPrice", fieldMap);
+                    if (ServiceUtil.isError(purchasePriceResultMap)) {
+                        String errorMessage = ServiceUtil.getErrorMessage(purchasePriceResultMap);
+                        throw new GeneralException(errorMessage);
+                    }
                     BigDecimal purchaseListPrice = (BigDecimal) purchasePriceResultMap.get("listPrice");
                     BigDecimal purchasePrice = (BigDecimal) purchasePriceResultMap.get("price");
                     if (purchaseListPrice != null) {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java?rev=1819730&r1=1819729&r2=1819730&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java Sun Dec 31 11:11:46 2017
@@ -70,6 +70,9 @@ public class CropImage {
             Map<String, Object> contentResult;
             try {
                 contentResult = dispatcher.runSync("createContent", contentCtx);
+                if (ServiceUtil.isError(contentResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(contentResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
@@ -81,6 +84,9 @@ public class CropImage {
             Map<String, Object> contentThumbResult;
             try {
                 contentThumbResult = dispatcher.runSync("createContent", contentThumb);
+                if (ServiceUtil.isError(contentThumbResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(contentThumbResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
@@ -123,7 +129,10 @@ public class CropImage {
             createContentAssocMap.put("userLogin", userLogin);
             createContentAssocMap.put("mapKey", "100");
             try {
-                dispatcher.runSync("createContentAssoc", createContentAssocMap);
+                Map<String, Object> serviceResult = dispatcher.runSync("createContentAssoc", createContentAssocMap);
+                if (ServiceUtil.isError(serviceResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
@@ -137,7 +146,10 @@ public class CropImage {
             productContentCtx.put("contentId", contentId);
             productContentCtx.put("statusId", "IM_PENDING");
             try {
-                dispatcher.runSync("createProductContent", productContentCtx);
+                Map<String, Object> serviceResult= dispatcher.runSync("createProductContent", productContentCtx);
+                if (ServiceUtil.isError(serviceResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
@@ -147,7 +159,10 @@ public class CropImage {
             contentApprovalCtx.put("contentId", contentId);
             contentApprovalCtx.put("userLogin", userLogin);
             try {
-                dispatcher.runSync("createImageContentApproval", contentApprovalCtx);
+                Map<String, Object> serviceResult = dispatcher.runSync("createImageContentApproval", contentApprovalCtx);
+                if (ServiceUtil.isError(serviceResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+                }
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());