You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/03/21 08:42:57 UTC

svn commit: r1787907 - in /ofbiz/ofbiz-framework/trunk/applications: order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java

Author: jleroux
Date: Tue Mar 21 08:42:57 2017
New Revision: 1787907

URL: http://svn.apache.org/viewvc?rev=1787907&view=rev
Log:
No functional changes, improves a bunch of exceptions

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java?rev=1787907&r1=1787906&r2=1787907&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java Tue Mar 21 08:42:57 2017
@@ -1851,8 +1851,10 @@ public class OrderReturnServices {
                                         GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", quantity));
                                         orderItemShipGroupInfo.add(newOrderItemShipGroupAssoc);
                                     }
-                                } catch (GenericEntityException gee) {
-                                    Debug.logError(gee, module);
+                                } catch (GenericEntityException e) {
+                                    String errMsg = "Problem calling the approveRequirement service";
+                                    Debug.logError(e, errMsg, module);
+                                    return ServiceUtil.returnError(errMsg);
                                 }
                                 // Create an association between the replacement order item and the order item of the original order
                                 GenericValue newOrderItemAssoc = delegator.makeValue("OrderItemAssoc", UtilMisc.toMap("orderId", orderHeader.getString("orderId"),

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=1787907&r1=1787906&r2=1787907&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 Tue Mar 21 08:42:57 2017
@@ -32,13 +32,13 @@ import org.apache.ofbiz.base.util.UtilPr
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
 import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.GenericEntityException;
+import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.entity.util.EntityUtilProperties;
 import org.apache.ofbiz.service.DispatchContext;
-import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.service.GenericServiceException;
+import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.service.ServiceUtil;
 
 public class ReplaceImage{
@@ -68,7 +68,7 @@ public class ReplaceImage{
                 }
             }
             else{
-            	 String errMsg = UtilProperties.getMessage(resourceError, "ProductPleaseChooseImageToReplace", locale);
+                 String errMsg = UtilProperties.getMessage(resourceError, "ProductPleaseChooseImageToReplace", locale);
                 Debug.logError(errMsg, module);
                 return ServiceUtil.returnError(errMsg);
             }
@@ -116,17 +116,13 @@ public class ReplaceImage{
                 productContentCtx.put("userLogin", userLogin);
                 dispatcher.runSync("removeProductContentAndImageFile", productContentCtx);
             }
-        } catch (GenericEntityException gee) {
+        } catch (GenericEntityException | GenericServiceException e) {
             String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale);
-            Debug.logError(errMsg, module);
+            Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
-        } catch (GenericServiceException gse) {
+        } catch (Exception e) {
             String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale);
-            Debug.logError(errMsg, module);
-            return ServiceUtil.returnError(errMsg);
-        } catch (Exception gse) {
-            String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale);
-            Debug.logError(errMsg, module);
+            Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
         String successMsg = UtilProperties.getMessage(resource, "ProductReplaceImageSuccessfully", locale);