Definitely changes the behavior, but the behavior wasn't good before (and still isn't good now). If we can't return an accurate order item sub-total then we should be throwing an exception IMO.
This is often why we can't just bulk fix the issues reported by static analysis tools, because the fix requires a thought-out solution that's totally dependent on the context of the code in question. Hiding these issues by removing an obvious problem and replacing it with a quick fix that doesn't solve the core problem only makes these bugs harder to find in the future. Better to put a FIXME tag in if there's no time to properly analyse the issue. Also worth noting the reality in this case, if your system is throwing EntityExceptions from a simple db read then whatever you're trying accomplish is already going to error out somewhere along the chain before or after this method is called. Regards Scott On 5 September 2017 at 07:28, Michael Brohl <michael.br...@ecomify.de> wrote: > Hi Jacques, > > I think directly returning the result inside the catch block changes the > logic of the code (the adjustments are not added). > > Please have another look. > > Thanks, > > Michael > > > Am 04.09.17 um 17:12 schrieb jler...@apache.org: > > Author: jleroux >> Date: Mon Sep 4 15:12:23 2017 >> New Revision: 1807240 >> >> URL: http://svn.apache.org/viewvc?rev=1807240&view=rev >> Log: >> Fixed: Fix Default or Empty Catch block in Java and Groovy files >> (OFBIZ-8341) >> >> In many Java and Groovy files we have auto generated catch blocks or >> empty catch >> blocks. >> To avoid such exception swallowing this should be improved to at least >> log the >> error and also return error in case of service. >> >> jleroux: I can't see what we could do more here, unlikely anyway >> >> Modified: >> ofbiz/ofbiz-framework/trunk/applications/order/src/main/jav >> a/org/apache/ofbiz/order/order/OrderReadHelper.java >> >> Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/order/OrderReadHelper.java >> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/app >> lications/order/src/main/java/org/apache/ofbiz/order/order/ >> OrderReadHelper.java?rev=1807240&r1=1807239&r2=1807240&view=diff >> ============================================================ >> ================== >> --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/order/OrderReadHelper.java (original) >> +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java >> /org/apache/ofbiz/order/order/OrderReadHelper.java Mon Sep 4 15:12:23 >> 2017 >> @@ -2414,10 +2414,13 @@ public class OrderReadHelper { >> List<GenericValue> workOrderItemFulfillments = null; >> try { >> workOrderItemFulfillments = >> orderItem.getDelegator().findByAnd("WorkOrderItemFulfillment", >> UtilMisc.toMap("orderId", orderItem.getString("orderId"), >> "orderItemSeqId", orderItem.getString("orderItemSeqId")), null, true); >> - } catch (GenericEntityException e) {} >> + } catch (GenericEntityException e) { >> + Debug.logError(e, module); >> + return result; >> + } >> if (workOrderItemFulfillments != null) { >> Iterator<GenericValue> iter = >> workOrderItemFulfillments.iterator(); >> - if (iter.hasNext()) { >> + if (iter.hasNext()) { >> GenericValue WorkOrderItemFulfillment = >> iter.next(); >> GenericValue workEffort = null; >> try { >> >> >> > >