Author: jleroux
Date: Tue Nov 8 07:42:45 2016 New Revision: 1768636 URL: http://svn.apache.org/viewvc?rev=1768636&view=rev Log: No functional changes related to r1768168. Uses Multiple catch blocks wherever it's possible, here with GenericEntityException and GenericServiceException. Also a generic case and tabs replaced Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java (original) +++ ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java Tue Nov 8 07:42:45 2016 @@ -165,10 +165,8 @@ public class FinAccountServices { if (ServiceUtil.isError(creditTransResult) || ServiceUtil.isFailure(creditTransResult)) { return creditTransResult; } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } Map<String, Object> result = ServiceUtil.returnSuccess(); Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java Tue Nov 8 07:42:45 2016 @@ -2893,10 +2893,8 @@ public class PaymentGatewayServices { try { dispatcher.addRollbackService("savePaymentGatewayResponse", context, true); delegator.create(pgr); - } catch (GenericEntityException gee) { - Debug.logError(gee, module); - } catch (GenericServiceException gse) { - Debug.logError(gse, module); + } catch (GenericEntityException|GenericServiceException ge) { + Debug.logError(ge, module); } catch (Exception e) { Debug.logError(e, module); } @@ -2913,10 +2911,8 @@ public class PaymentGatewayServices { for (GenericValue message : messages) { delegator.create(message); } - } catch (GenericEntityException gee) { - Debug.logError(gee, module); - } catch (GenericServiceException gse) { - Debug.logError(gse, module); + } catch (GenericEntityException|GenericServiceException ge) { + Debug.logError(ge, module); } catch (Exception e) { Debug.logError(e, module); } @@ -3045,7 +3041,7 @@ public class PaymentGatewayServices { } // prepare the order payment preference (facade) - GenericValue orderPaymentPref = delegator.makeValue("OrderPaymentPreference", new HashMap()); + GenericValue orderPaymentPref = delegator.makeValue("OrderPaymentPreference", new HashMap<String, Object>()); orderPaymentPref.set("orderPaymentPreferenceId", "_NA_"); orderPaymentPref.set("orderId", "_NA_"); orderPaymentPref.set("presentFlag", "N"); Modified: ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java (original) +++ ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java Tue Nov 8 07:42:45 2016 @@ -152,10 +152,8 @@ public final class BOMHelper { } dispatcher.runSync("createProductionRunsForOrder", UtilMisc.<String, Object>toMap("quantity", shipmentPlan.getBigDecimal("quantity"), "orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId"), "shipmentId", shipmentId, "userLogin", userLogin)); } - } catch (GenericEntityException gee) { - Debug.logWarning(gee, module); - } catch (GenericServiceException gse) { - Debug.logWarning(gse, module); + } catch (GenericEntityException|GenericServiceException ge) { + Debug.logWarning(ge, module); } catch (Exception e) { // if there is an exception for either, the other probably wont work Debug.logWarning(e, module); Modified: ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java Tue Nov 8 07:42:45 2016 @@ -192,10 +192,8 @@ public class BOMServices { variantProduct.store(); } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", gee.getMessage()), locale)); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", gse.getMessage()), locale)); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", ge.getMessage()), locale)); } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } Modified: ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Tue Nov 8 07:42:45 2016 @@ -1157,10 +1157,8 @@ public class ProductionRunServices { dispatcher.runSync("createCostComponent", inMap); } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", gee.getMessage()), locale)); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", gse.getMessage()), locale)); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } @@ -1191,10 +1189,8 @@ public class ProductionRunServices { inMap.put("cost", materialsCost); dispatcher.runSync("createCostComponent", inMap); } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", gee.getMessage()), locale)); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", gse.getMessage()), locale)); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } @@ -1707,14 +1703,14 @@ public class ProductionRunServices { // Before creating InvntoryItem and InventoryItemDetails, check weather the record of ProductFacility exist in the system or not GenericValue productFacility = EntityQuery.use(delegator). from("ProductFacility").where("productId", productionRun.getProductProduced().getString("productId") - , "facilityId", facility.get("facilityId")).queryOne(); + , "facilityId", facility.get("facilityId")).queryOne(); if (productFacility == null) { - Map<String, Object> createProductFacilityCtx = new HashMap<String, Object>(); - createProductFacilityCtx.put("productId", productionRun.getProductProduced().getString("productId")); - createProductFacilityCtx.put("facilityId", facility.get("facilityId")); - createProductFacilityCtx.put("userLogin", userLogin); - dispatcher.runSync("createProductFacility", createProductFacilityCtx); + Map<String, Object> createProductFacilityCtx = new HashMap<String, Object>(); + createProductFacilityCtx.put("productId", productionRun.getProductProduced().getString("productId")); + createProductFacilityCtx.put("facilityId", facility.get("facilityId")); + createProductFacilityCtx.put("userLogin", userLogin); + dispatcher.runSync("createProductFacility", createProductFacilityCtx); } } catch (GenericServiceException gse) { Modified: ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java Tue Nov 8 07:42:45 2016 @@ -1649,10 +1649,8 @@ public class EbayStore { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); result.put(ModelService.ERROR_MESSAGE_LIST, ProductsExportToEbay.getproductExportFailureMessageList()); } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } Modified: ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1768636&r1=1768635&r2=1768636&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java Tue Nov 8 07:42:45 2016 @@ -212,7 +212,7 @@ public class EbayStoreAutoPreferences { } } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); + return ServiceUtil.returnError(gee.getMessage()); } catch (Exception e) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "EbayStoreProblemConnectingToEbaySite", locale) + e); } @@ -496,10 +496,8 @@ public class EbayStoreAutoPreferences { } } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } @@ -571,10 +569,8 @@ public class EbayStoreAutoPreferences { } } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } @@ -646,10 +642,8 @@ public class EbayStoreAutoPreferences { } } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } @@ -1152,10 +1146,8 @@ public class EbayStoreAutoPreferences { } } } - } catch (GenericEntityException gee) { - return ServiceUtil.returnError(gee.getMessage()); - } catch (GenericServiceException gse) { - return ServiceUtil.returnError(gse.getMessage()); + } catch (GenericEntityException|GenericServiceException ge) { + return ServiceUtil.returnError(ge.getMessage()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } |
Free forum by Nabble | Edit this page |