svn commit: r1824294 - in /ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility: facility/CountFacilityInventoryByProduct.groovy facility/ViewFacilityInventoryByProduct.groovy shipment/ReceiveInventoryAgainstPurchaseOrder.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1824294 - in /ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility: facility/CountFacilityInventoryByProduct.groovy facility/ViewFacilityInventoryByProduct.groovy shipment/ReceiveInventoryAgainstPurchaseOrder.groovy

jleroux@apache.org
Author: jleroux
Date: Thu Feb 15 11:01:41 2018
New Revision: 1824294

URL: http://svn.apache.org/viewvc?rev=1824294&view=rev
Log:
Fixed: Fix Default or Empty Catch block in Java and Groovy files
(OFBIZ-8341)

Fixes few remaining swallowed Exception in Groovy files.

Not sure if always showing an error message in ui is a good idea.
But this should not happen too often and could help users to fix wrong passed
numbers...

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
    ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
    ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy

Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy?rev=1824294&r1=1824293&r2=1824294&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy Thu Feb 15 11:01:41 2018
@@ -181,7 +181,8 @@ if (action) {
             checkTime = UtilDateTime.toTimestamp(cal.getTime())
             searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr
         } catch (Exception e) {
-            // Ignore
+            Debug.logError(e, "Caught an exception : " + e.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log")
         }
     }
 
@@ -278,7 +279,8 @@ if (action) {
                         try {
                             salesUsageQuantity += salesUsageItem.getDouble("quantity").doubleValue()
                         } catch (Exception e) {
-                            // Ignore
+                            Debug.logError(e, "Caught an exception : " + e.toString(), module)
+                            request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log")
                         }
                     }
                 }
@@ -299,7 +301,8 @@ if (action) {
                         try {
                             productionUsageQuantity += productionUsageItem.getDouble("quantity").doubleValue()
                         } catch (Exception e) {
-                            // Ignore
+                            Debug.logError(e, "Caught an exception : " + e.toString(), module)
+                            request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log")
                         }
                     }
                 }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy?rev=1824294&r1=1824293&r2=1824294&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy Thu Feb 15 11:01:41 2018
@@ -174,7 +174,8 @@ if (action) {
             checkTime = UtilDateTime.toTimestamp(cal.getTime())
             searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr
         } catch (Exception e) {
-            // Ignore
+            Debug.logError(e, "Caught an exception : " + e.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log")
         }
     }
 

Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy?rev=1824294&r1=1824293&r2=1824294&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy Thu Feb 15 11:01:41 2018
@@ -216,8 +216,10 @@ if (productIdToReceive) {
         if (productQtyToReceive) {
             try {
                 quantity = Double.parseDouble(productQtyToReceive)
-            } catch (Exception e) {
+            } catch (NumberFormatException nfe) {
                 // Ignore the quantity update if there's a problem parsing it
+                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module)
+                request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log")
             }
         }