Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java Sun Dec 31 11:11:46 2017 @@ -129,6 +129,9 @@ public class FrameImage { Map<String, Object> contentResult = new HashMap<>(); try { contentResult = dispatcher.runSync("createContent", contentCtx); + if (ServiceUtil.isError(contentResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(contentResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); result = ServiceUtil.returnError(e.getMessage()); @@ -141,6 +144,9 @@ public class FrameImage { Map<String, Object> contentThumbResult = new HashMap<>(); try { contentThumbResult = dispatcher.runSync("createContent", contentThumb); + if (ServiceUtil.isError(contentThumbResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(contentThumbResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); result = ServiceUtil.returnError(e.getMessage()); @@ -177,7 +183,10 @@ public class FrameImage { 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); result = ServiceUtil.returnError(e.getMessage()); @@ -192,7 +201,10 @@ public class FrameImage { 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); result = ServiceUtil.returnError(e.getMessage()); @@ -203,7 +215,10 @@ public class FrameImage { 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); result = ServiceUtil.returnError(e.getMessage()); @@ -304,6 +319,12 @@ public class FrameImage { dataResourceCtx.put("mimeTypeId", "image/png"); dataResourceCtx.put("isPublic", "Y"); Map<String, Object> dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + String errorMessage = ServiceUtil.getErrorMessage(dataResourceResult); + request.setAttribute("_ERROR_MESSAGE_", errorMessage); + Debug.logError(errorMessage, module); + return "error"; + } dataResourceId = dataResourceResult.get("dataResourceId").toString(); //create content Map<String, Object> contentCtx = new HashMap<>(); @@ -313,6 +334,12 @@ public class FrameImage { contentCtx.put("fromDate", UtilDateTime.nowTimestamp()); contentCtx.put("userLogin", userLogin); Map<String, Object> contentResult = dispatcher.runSync("createContent", contentCtx); + if (ServiceUtil.isError(contentResult)) { + String errorMessage = ServiceUtil.getErrorMessage(contentResult); + request.setAttribute("_ERROR_MESSAGE_", errorMessage); + Debug.logError(errorMessage, module); + return "error"; + } contentId = contentResult.get("contentId").toString(); } catch (GenericServiceException | IOException gse) { request.setAttribute("_ERROR_MESSAGE_", gse.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java Sun Dec 31 11:11:46 2017 @@ -107,6 +107,9 @@ public class ImageManagementServices { 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()); @@ -214,7 +217,10 @@ public class ImageManagementServices { 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()); @@ -228,7 +234,10 @@ public class ImageManagementServices { 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()); @@ -238,7 +247,10 @@ public class ImageManagementServices { 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()); @@ -251,7 +263,10 @@ public class ImageManagementServices { autoApproveCtx.put("userLogin", userLogin); autoApproveCtx.put("checkStatusId", "IM_APPROVED"); try { - dispatcher.runSync("updateStatusImageManagement", autoApproveCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateStatusImageManagement", autoApproveCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -417,6 +432,9 @@ public class ImageManagementServices { Map<String, Object> dataResourceResult; try { dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(dataResourceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -432,7 +450,10 @@ public class ImageManagementServices { contentUp.put("contentName", filenameToUse); contentUp.put("userLogin", userLogin); try { - dispatcher.runSync("updateContent", contentUp); + Map<String, Object> serviceResult = dispatcher.runSync("updateContent", contentUp); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -458,7 +479,10 @@ public class ImageManagementServices { if (dataResource != null) { dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId")); try { - dispatcher.runSync("updateDataResource", dataResourceCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateDataResource", dataResourceCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -483,6 +507,9 @@ public class ImageManagementServices { 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()); @@ -674,6 +701,9 @@ public class ImageManagementServices { 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()); @@ -690,7 +720,10 @@ public class ImageManagementServices { createContentAssocMap.put("userLogin", userLogin); createContentAssocMap.put("mapKey", width); 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()); @@ -763,7 +796,10 @@ public class ImageManagementServices { contentUp.put("contentName", filenameToUse); contentUp.put("userLogin", userLogin); try { - dispatcher.runSync("updateContent", contentUp); + Map<String, Object> serviceResult = dispatcher.runSync("updateContent", contentUp); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -791,7 +827,10 @@ public class ImageManagementServices { dataResourceCtx.put("dataResourceName", filenameToUse); dataResourceCtx.put("userLogin", userLogin); try { - dispatcher.runSync("updateDataResource", dataResourceCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateDataResource", dataResourceCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -824,7 +863,10 @@ public class ImageManagementServices { contentAssocMap.put("contentName", filenameToUseAssoc); contentAssocMap.put("userLogin", userLogin); try { - dispatcher.runSync("updateContent", contentAssocMap); + Map<String, Object> serviceResult = dispatcher.runSync("updateContent", contentAssocMap); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -852,7 +894,10 @@ public class ImageManagementServices { dataResourceAssocMap.put("dataResourceName", filenameToUseAssoc); dataResourceAssocMap.put("userLogin", userLogin); try { - dispatcher.runSync("updateDataResource", dataResourceAssocMap); + Map<String, Object> serviceResult = dispatcher.runSync("updateDataResource", dataResourceAssocMap); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java Sun Dec 31 11:11:46 2017 @@ -115,7 +115,10 @@ public class ReplaceImage{ productContentCtx.put("productContentTypeId", "IMAGE"); productContentCtx.put("fromDate", productContent.get("fromDate")); productContentCtx.put("userLogin", userLogin); - dispatcher.runSync("removeProductContentAndImageFile", productContentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("removeProductContentAndImageFile", productContentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } } catch (IOException | IllegalArgumentException | GenericEntityException | GenericServiceException e) { String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java Sun Dec 31 11:11:46 2017 @@ -68,6 +68,9 @@ public class RotateImage { 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()); @@ -79,6 +82,9 @@ public class RotateImage { 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()); @@ -130,7 +136,10 @@ public class RotateImage { 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()); @@ -144,7 +153,10 @@ public class RotateImage { 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()); @@ -154,7 +166,10 @@ public class RotateImage { 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()); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java Sun Dec 31 11:11:46 2017 @@ -911,6 +911,9 @@ public class ProductServices { Map<String, Object> invRes = null; try { invRes = dispatcher.runSync("getProductInventoryAvailable", UtilMisc.<String, Object>toMap("productId", productId, "userLogin", userLogin)); + if (ServiceUtil.isError(invRes)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(invRes)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1152,7 +1155,10 @@ public class ProductServices { if (dataResource != null) { dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId")); try { - dispatcher.runSync("updateDataResource", dataResourceCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateDataResource", dataResourceCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1163,6 +1169,9 @@ public class ProductServices { Map<String, Object> dataResourceResult; try { dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(dataResourceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1173,7 +1182,10 @@ public class ProductServices { contentCtx.put("dataResourceId", dataResourceResult.get("dataResourceId")); contentCtx.put("userLogin", userLogin); try { - dispatcher.runSync("updateContent", contentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateContent", contentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1182,7 +1194,10 @@ public class ProductServices { productContentCtx.put("contentId", contentId); try { - dispatcher.runSync("updateProductContent", productContentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateProductContent", productContentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1194,6 +1209,9 @@ public class ProductServices { Map<String, Object> dataResourceResult; try { dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(dataResourceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1206,6 +1224,9 @@ public class ProductServices { 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()); @@ -1213,7 +1234,10 @@ public class ProductServices { productContentCtx.put("contentId", contentResult.get("contentId")); 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()); @@ -1366,7 +1390,10 @@ public class ProductServices { if (dataResource != null) { dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId")); try { - dispatcher.runSync("updateDataResource", dataResourceCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateDataResource", dataResourceCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1377,6 +1404,9 @@ public class ProductServices { Map<String, Object> dataResourceResult; try { dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(dataResourceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1387,7 +1417,10 @@ public class ProductServices { contentCtx.put("dataResourceId", dataResourceResult.get("dataResourceId")); contentCtx.put("userLogin", userLogin); try { - dispatcher.runSync("updateContent", contentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateContent", contentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1396,7 +1429,10 @@ public class ProductServices { productPromoContentCtx.put("contentId", contentId); try { - dispatcher.runSync("updateProductPromoContent", productPromoContentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateProductPromoContent", productPromoContentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1408,6 +1444,9 @@ public class ProductServices { Map<String, Object> dataResourceResult; try { dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx); + if (ServiceUtil.isError(dataResourceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(dataResourceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1420,6 +1459,9 @@ public class ProductServices { 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()); @@ -1427,7 +1469,10 @@ public class ProductServices { productPromoContentCtx.put("contentId", contentResult.get("contentId")); try { - dispatcher.runSync("createProductPromoContent", productPromoContentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("createProductPromoContent", productPromoContentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1443,7 +1488,10 @@ public class ProductServices { productPromoContentCtx.put("thruDate", context.get("thruDate")); productPromoContentCtx.put("userLogin", userLogin); try { - dispatcher.runSync("updateProductPromoContent", productPromoContentCtx); + Map<String, Object> serviceResult = dispatcher.runSync("updateProductPromoContent", productPromoContentCtx); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java Sun Dec 31 11:11:46 2017 @@ -937,6 +937,12 @@ public class PackingSession implements j serviceContext.put("shippableTotal", shippableTotal); serviceResult = getDispatcher().runSync("calcShipmentCostEstimate", serviceContext); + + if (ServiceUtil.isError(serviceResult)) { + Debug.logError(ServiceUtil.getErrorMessage(serviceResult), module); + return shipmentCostEstimate; + } + } catch (GenericEntityException e) { Debug.logError(e, module); } catch (GenericServiceException e) { Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java Sun Dec 31 11:11:46 2017 @@ -34,6 +34,7 @@ import org.apache.ofbiz.entity.GenericVa import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.service.GenericServiceException; import org.apache.ofbiz.service.LocalDispatcher; +import org.apache.ofbiz.service.ServiceUtil; /** * ShippingEvents - Events used for processing shipping fees @@ -99,7 +100,13 @@ public class ShipmentEvents { try { Map<String, Object> inputMap = UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED"); inputMap.put("userLogin", userLogin); - dispatcher.runSync("updateShipment", inputMap); + Map<String, Object> resultMap = dispatcher.runSync("updateShipment", inputMap); + if (ServiceUtil.isError(resultMap)) { + String errorMessage = ServiceUtil.getErrorMessage(resultMap); + request.setAttribute("_ERROR_MESSAGE_", errorMessage); + Debug.logError(errorMessage, module); + return "error"; + } } catch (GenericServiceException gse) { String errMsg = "Error updating shipment [" + shipmentId + "]: " + gse.toString(); request.setAttribute("_ERROR_MESSAGE_", errMsg); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java Sun Dec 31 11:11:46 2017 @@ -858,7 +858,10 @@ public class ShipmentServices { } // now update the shipment - dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED", "userLogin", userLogin)); + Map<String, Object> serviceResult = dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED", "userLogin", userLogin)); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -900,7 +903,7 @@ public class ShipmentServices { Map<String, Object> tmpResult = dispatcher.runSync("createShipmentRouteSegment", params); if (ServiceUtil.isError(tmpResult)) { - return tmpResult; + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult)); } else { results.put("newShipmentRouteSegmentId", tmpResult.get("shipmentRouteSegmentId")); return results; @@ -999,7 +1002,9 @@ public class ShipmentServices { // Get the value of the orderItem by calling the getOrderItemInvoicedAmountAndQuantity service Map<String, Object> getOrderItemValueResult = dispatcher.runSync("getOrderItemInvoicedAmountAndQuantity", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "userLogin", userLogin, "locale", locale)); - if (ServiceUtil.isError(getOrderItemValueResult)) return getOrderItemValueResult; + if (ServiceUtil.isError(getOrderItemValueResult)){ + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(getOrderItemValueResult)); + } BigDecimal invoicedAmount = (BigDecimal) getOrderItemValueResult.get("invoicedAmount"); BigDecimal invoicedQuantity = (BigDecimal) getOrderItemValueResult.get("invoicedQuantity"); @@ -1014,7 +1019,7 @@ public class ShipmentServices { GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader", false); Map<String, Object> convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", packageContentValue)); if (ServiceUtil.isError(convertUomResult)) { - return convertUomResult; + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(convertUomResult)); } if (convertUomResult.containsKey("convertedValue")) { packageContentValue = ((BigDecimal) convertUomResult.get("convertedValue")).setScale(decimals, rounding); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java Sun Dec 31 11:11:46 2017 @@ -37,6 +37,7 @@ import org.apache.ofbiz.service.Dispatch import org.apache.ofbiz.service.GenericServiceException; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ModelService; +import org.apache.ofbiz.service.ServiceUtil; /** * ShipmentWorker - Worker methods for Shipment and related entities @@ -187,6 +188,10 @@ public final class ShipmentWorker { Map<String, Object> result = new HashMap<String, Object>(); try { result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", productWeight)); + if (ServiceUtil.isError(result)) { + Debug.logError(ServiceUtil.getErrorMessage(result), module); + return totalWeight; + } } catch (GenericServiceException ex) { Debug.logError(ex, module); } Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java Sun Dec 31 11:11:46 2017 @@ -590,6 +590,9 @@ public class DhlServices { String recipientEmail = null; Map<String, Object> results = dispatcher.runSync("getPartyEmail", UtilMisc.toMap("partyId", shipment.get("partyIdTo"), "userLogin", userLogin)); + if (ServiceUtil.isError(results)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results)); + } if (results.get("emailAddress") != null) { recipientEmail = (String) results.get("emailAddress"); } @@ -666,6 +669,9 @@ public class DhlServices { weightUomId = "WT_lb"; // TODO: this should be specified in a properties file } results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", DHL_WEIGHT_UOM_ID, "originalValue", packageWeight)); + if (ServiceUtil.isError(results)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results)); + } if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) || (results.get("convertedValue") == null)) { Debug.logWarning("Unable to convert weights for shipmentId " + shipmentId , module); packageWeight = BigDecimal.ONE; Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java Sun Dec 31 11:11:46 2017 @@ -1664,8 +1664,11 @@ public class UpsServices { cxt.put("shipFromAddress", shipFromAddress); cxt.put("shipmentGatewayConfigId", context.get("shipmentGatewayConfigId")); try { - return dctx.getDispatcher().runSync("upsRateEstimateByPostalCode", cxt); - + Map<String, Object> serviceResult = dctx.getDispatcher().runSync("upsRateEstimateByPostalCode", cxt); + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } + return serviceResult; } catch (GenericServiceException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUpsRateEstimateError", @@ -2373,12 +2376,18 @@ public class UpsServices { } Map<String, Object> destEmail = dispatcher.runSync("getPartyEmail", UtilMisc.toMap("partyId", shipment.get("partyIdTo"), "userLogin", userLogin)); + if (ServiceUtil.isError(destEmail)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(destEmail)); + } String recipientEmail = null; if (UtilValidate.isNotEmpty(destEmail.get("emailAddress"))) { recipientEmail = (String) destEmail.get("emailAddress"); } String senderEmail = null; Map<String, Object> originEmail = dispatcher.runSync("getPartyEmail", UtilMisc.toMap("partyId", shipment.get("partyIdFrom"), "userLogin", userLogin)); + if (ServiceUtil.isError(originEmail)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(originEmail)); + } if (UtilValidate.isNotEmpty(originEmail.get("emailAddress"))) { senderEmail = (String) originEmail.get("emailAddress"); } Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java Sun Dec 31 11:11:46 2017 @@ -1057,6 +1057,9 @@ public class UspsServices { Map<String, Object> result; try { result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", weight)); + if (ServiceUtil.isError(result)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); + } } catch (GenericServiceException ex) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUspsWeightConversionError", Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java Sun Dec 31 11:11:46 2017 @@ -24,9 +24,11 @@ import java.util.List; import java.util.Map; import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.service.ModelService; +import org.apache.ofbiz.service.ServiceUtil; import org.apache.ofbiz.service.testtools.OFBizTestCase; /** @@ -54,6 +56,10 @@ public class UspsServicesTests extends O // run the service Map<String, Object> result = dispatcher.runSync("uspsTrackConfirm", UtilMisc.toMap("trackingId", "EJ958083578US", "shipmentGatewayConfigId", "USPS_CONFIG", "configProps", "shipment")); + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); @@ -88,6 +94,10 @@ public class UspsServicesTests extends O paramInp.put("shipmentGatewayConfigId", "USPS_CONFIG"); paramInp.put("configProps", "shipment"); Map<String, Object> result = dispatcher.runSync("uspsAddressValidation", paramInp); + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); @@ -119,7 +129,10 @@ public class UspsServicesTests extends O // run the service Map<String, Object> result = dispatcher.runSync("uspsCityStateLookup", UtilMisc.toMap("zip5", "90210", "shipmentGatewayConfigId", "USPS_CONFIG", "configProps", "shipment")); - + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testUspsCityStateLookup] responseMessage: " + responseMessage, module); @@ -138,7 +151,10 @@ public class UspsServicesTests extends O // run the service Map<String, Object> result = dispatcher.runSync("uspsPriorityMailStandard", UtilMisc.toMap("originZip", "4", "destinationZip", "4", "shipmentGatewayConfigId", "USPS_CONFIG", "configProps", "shipment")); - + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testUspsPriorityMailStandard] responseMessage: " + responseMessage, module); @@ -153,7 +169,10 @@ public class UspsServicesTests extends O // run the service Map<String, Object> result = dispatcher.runSync("uspsPackageServicesStandard", UtilMisc.toMap("originZip", "4", "destinationZip", "4", "shipmentGatewayConfigId", "USPS_CONFIG", "configProps", "shipment")); - + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testUspsPackageServicesStandard] responseMessage: " + responseMessage, module); @@ -182,7 +201,10 @@ public class UspsServicesTests extends O // run the service Map<String, Object> result = dispatcher.runSync("uspsDomesticRate", context); - + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + throw new GeneralException(errorMessage); + } // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testUspsDomesticRate] responseMessage: " + responseMessage, module); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java Sun Dec 31 11:11:46 2017 @@ -316,7 +316,10 @@ public class VerifyPickSession implement updateShipmentCtx.put("shipmentId", shipmentId); updateShipmentCtx.put("statusId", "SHIPMENT_PICKED"); updateShipmentCtx.put("userLogin", this.getUserLogin()); - this.getDispatcher().runSync("updateShipment", updateShipmentCtx); + Map<String, Object> serviceResult = this.getDispatcher().runSync("updateShipment", updateShipmentCtx); + if (ServiceUtil.isError(serviceResult)) { + throw new GeneralException(ServiceUtil.getErrorMessage(serviceResult)); + } return shipmentId; } Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java Sun Dec 31 11:11:46 2017 @@ -517,6 +517,9 @@ public class WeightPackageSession implem } shipCostEstimateMap.put("shippableTotal", shippableTotal); shipCostEstimateResult = getDispatcher().runSync("calcShipmentCostEstimate", shipCostEstimateMap); + if (ServiceUtil.isError(shipCostEstimateResult)) { + Debug.logError(ServiceUtil.getErrorMessage(shipCostEstimateResult), module); + } } catch (GeneralException e) { Debug.logError(e, module); } Modified: ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java Sun Dec 31 11:11:46 2017 @@ -59,6 +59,7 @@ import org.apache.ofbiz.service.ModelSer import org.apache.ofbiz.webapp.control.LoginWorker; import edu.emory.mathcs.backport.java.util.Arrays; +import org.apache.ofbiz.service.ServiceUtil; /** * LoginEvents - Events for UserLogin and Security handling. @@ -359,6 +360,12 @@ public class LoginEvents { try { Map<String, Object> result = dispatcher.runSync("sendMailHiddenInLogFromScreen", serviceContext); + if (ServiceUtil.isError(result)) { + String errorMessage = ServiceUtil.getErrorMessage(result); + request.setAttribute("_ERROR_MESSAGE_", errorMessage); + Debug.logError(errorMessage, module); + return "error"; + } if (ModelService.RESPOND_ERROR.equals(result.get(ModelService.RESPONSE_MESSAGE))) { Map<String, Object> messageMap = UtilMisc.toMap("errorMessage", result.get(ModelService.ERROR_MESSAGE)); Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java Sun Dec 31 11:11:46 2017 @@ -486,7 +486,11 @@ public class ICalConverter { } localMap.put("locale", context.get("locale")); try { - return dispatcher.runSync(serviceName, localMap); + Map<String, Object> result = dispatcher.runSync(serviceName, localMap); + if (ServiceUtil.isError(result)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); + } + return result; } catch (GenericServiceException e) { String errMsg = UtilProperties.getMessage("WorkEffortUiLabels", "WorkeffortErrorWhileInvokingService", UtilMisc.toMap("serviceName", serviceName), locale); Debug.logError(e, errMsg, module); Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalWorker.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalWorker.java Sun Dec 31 11:11:46 2017 @@ -268,7 +268,10 @@ public final class ICalWorker { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String, Object> result = dispatcher.runSync("userLogin", serviceMap); if (ServiceUtil.isError(result) || ServiceUtil.isFailure(result)) { - return; + String errorMessage = ServiceUtil.getErrorMessage(result); + request.setAttribute("_ERROR_MESSAGE_", errorMessage); + Debug.logError(errorMessage, module); + throw new GenericServiceException(errorMessage); } userLogin = (GenericValue) result.get("userLogin"); request.setAttribute("userLogin", userLogin); Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java Sun Dec 31 11:11:46 2017 @@ -30,6 +30,7 @@ import org.apache.ofbiz.entity.util.Enti import org.apache.ofbiz.service.GenericServiceException; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ModelService; +import org.apache.ofbiz.service.ServiceUtil; /** * WorkEffortPartyAssignmentServices - Services to handle form input and other data changes. @@ -60,7 +61,9 @@ public class WorkEffortPartyAssignmentSe // accept the activity assignment try { Map<String, Object> results = dispatcher.runSync("wfAcceptAssignment", context); - + if (ServiceUtil.isError(results)) { + Debug.logWarning((String) results.get(ModelService.ERROR_MESSAGE), module); + } if (results != null && results.get(ModelService.ERROR_MESSAGE) != null) { Debug.logWarning((String) results.get(ModelService.ERROR_MESSAGE), module); } @@ -71,7 +74,9 @@ public class WorkEffortPartyAssignmentSe // complete the activity assignment try { Map<String, Object> results = dispatcher.runSync("wfCompleteAssignment", context); - + if (ServiceUtil.isError(results)) { + Debug.logWarning((String) results.get(ModelService.ERROR_MESSAGE), module); + } if (results != null && results.get(ModelService.ERROR_MESSAGE) != null) { Debug.logWarning((String) results.get(ModelService.ERROR_MESSAGE), module); } Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1819730&r1=1819729&r2=1819730&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java Sun Dec 31 11:11:46 2017 @@ -972,7 +972,10 @@ public class WorkEffortServices { try { parameters.put("eventDateTime", new Timestamp(eventDateTime.getTime())); - dispatcher.runSync("processWorkEffortEventReminder", processCtx); + Map<String, Object> result = dispatcher.runSync("processWorkEffortEventReminder", processCtx); + if (ServiceUtil.isError(result)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); + } if (repeatCount != 0 && currentCount + 1 >= repeatCount) { reminder.remove(); } else { @@ -1013,7 +1016,10 @@ public class WorkEffortServices { if (reminderDateTime.before(now)) { try { parameters.put("eventDateTime", eventDateTime); - dispatcher.runSync("processWorkEffortEventReminder", processCtx); + Map<String, Object> result = dispatcher.runSync("processWorkEffortEventReminder", processCtx); + if (ServiceUtil.isError(result)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); + } TimeDuration duration = TimeDuration.fromNumber(reminder.getLong("repeatInterval")); if ((repeatCount != 0 && currentCount + 1 >= repeatCount) || duration.isZero()) { reminder.remove(); |
Free forum by Nabble | Edit this page |