Yes thanks Michael,

I agree with Scott about rather throwing an exception

Jacques


Le 04/09/2017 à 21:28, Michael Brohl a écrit :
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/java/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/applications/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 {





Reply via email to