Forwarding an email that I sent yesterday and seems to be lost in the net. Jacopo
On Tue, Mar 21, 2017 at 10:29 AM, Jacopo Cappellato < [email protected]> wrote: > Jacques, > > I have some concerns about this and similar changes you are committing in > the attempt to improve exception handling: converting a swallowed exception > into a service/event error is actually introducing a pretty relevant > functional change. Maybe the original code was intended to ignore the > exception and move one with additional business logic: however a bulk > change without a deep study/testing of every specific change you are > introducing is not the right way to go in my opinion. I would recommend to > revert these commits and perform an analysis and testing before introducing > these changes. > > Jacopo > > On Tue, Mar 21, 2017 at 9:40 AM, <[email protected]> wrote: > >> Author: jleroux >> Date: Tue Mar 21 08:40:07 2017 >> New Revision: 1787906 >> >> URL: http://svn.apache.org/viewvc?rev=1787906&view=rev >> Log: >> No functional changes, fixes a bunch of swallowed exceptions >> >> Modified: >> ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/Produ >> ctionRunServices.java >> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java >> ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java >> >> Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/Produ >> ctionRunServices.java >> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >> lications/manufacturing/src/main/java/org/apache/ofbiz/ >> manufacturing/jobshopmgt/ProductionRunServices.java?rev= >> 1787906&r1=1787905&r2=1787906&view=diff >> ============================================================ >> ================== >> --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java >> (original) >> +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/ >> main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java >> Tue Mar 21 08:40:07 2017 >> @@ -2214,10 +2214,10 @@ public class ProductionRunServices { >> } >> } >> } >> - } catch (GenericEntityException gee) { >> - >> - } catch (GenericServiceException gee) { >> - >> + } catch (GenericEntityException | >> GenericServiceException e) { >> + String errMsg = "Problem calling the >> updateProductionRunTaskStatus service"; >> + Debug.logError(e, errMsg, module); >> + return ServiceUtil.returnError(errMsg); >> } >> } >> } >> @@ -2264,7 +2264,10 @@ public class ProductionRunServices { >> GenericValue requirement = null; >> try { >> requirement = EntityQuery.use(delegator).fro >> m("Requirement").where("requirementId", requirementId).queryOne(); >> - } catch (GenericEntityException gee) { >> + } catch (GenericEntityException e) { >> + String errMsg = "Problem calling the approveRequirement >> service"; >> + Debug.logError(e, errMsg, module); >> + return ServiceUtil.returnError(errMsg); >> } >> >> if (requirement == null) { >> @@ -2295,7 +2298,10 @@ public class ProductionRunServices { >> GenericValue requirement = null; >> try { >> requirement = EntityQuery.use(delegator).fro >> m("Requirement").where("requirementId", requirementId).queryOne(); >> - } catch (GenericEntityException gee) { >> + } catch (GenericEntityException e) { >> + String errMsg = "Problem calling the >> createProductionRunFromRequirement service"; >> + Debug.logError(e, errMsg, module); >> + return ServiceUtil.returnError(errMsg); >> } >> if (requirement == null) { >> return >> ServiceUtil.returnError(UtilProperties.getMessage(resource, >> "ManufacturingRequirementNotExists", locale)); >> >> 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/app >> lications/order/src/main/java/org/apache/ofbiz/order/shoppin >> gcart/ShoppingCartEvents.java?rev=1787906&r1=1787905&r2=1787906&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 Tue Mar 21 >> 08:40:07 2017 >> @@ -1624,7 +1624,8 @@ public class ShoppingCartEvents { >> .filterByDate() >> .queryList(); >> } catch (GenericEntityException gee) { >> - // >> + request.setAttribute("_ERROR_MESSAGE_", >> gee.getMessage()); >> + return "error"; >> } >> if (UtilValidate.isNotEmpty(storeReps)) { >> hasPermission = true; >> @@ -1674,7 +1675,8 @@ public class ShoppingCartEvents { >> try { >> thisUserLogin = EntityQuery.use(delegator).fro >> m("UserLogin").where("userLoginId", userLoginId).queryOne(); >> } catch (GenericEntityException gee) { >> - // >> + request.setAttribute("_ERROR_MESSAGE_", >> gee.getMessage()); >> + return "error"; >> } >> if (thisUserLogin != null) { >> partyId = thisUserLogin.getString("partyId"); >> @@ -1687,7 +1689,8 @@ public class ShoppingCartEvents { >> try { >> thisParty = >> EntityQuery.use(delegator).from("Party").where("partyId", >> partyId).queryOne(); >> } catch (GenericEntityException gee) { >> - // >> + request.setAttribute("_ERROR_MESSAGE_", >> gee.getMessage()); >> + return "error"; >> } >> if (thisParty == null) { >> request.setAttribute("_ERROR_MESSAGE_", >> UtilProperties.getMessage(resource_error,"OrderCouldNotLocateTheSelectedParty", >> locale)); >> >> Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java >> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >> lications/order/src/main/java/org/apache/ofbiz/order/shoppin >> gcart/ShoppingCartHelper.java?rev=1787906&r1=1787905&r2=1787906&view=diff >> ============================================================ >> ================== >> --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) >> +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java Tue Mar 21 >> 08:40:07 2017 >> @@ -516,6 +516,7 @@ public class ShoppingCartHelper { >> try { >> requirement = EntityQuery.use(delegator).fro >> m("Requirement").where("requirementId", requirementId).queryOne(); >> } catch (GenericEntityException gee) { >> + Debug.logError(gee, module); >> } >> if (requirement == null) { >> return ServiceUtil.returnFailure(Util >> Properties.getMessage(resource, >> >> >> >
