svn commit: r1824157 - in /ofbiz/ofbiz-framework/trunk/applications: order/groovyScripts/entry/ product/groovyScripts/facility/facility/

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

svn commit: r1824157 - in /ofbiz/ofbiz-framework/trunk/applications: order/groovyScripts/entry/ product/groovyScripts/facility/facility/

jleroux@apache.org
Author: jleroux
Date: Tue Feb 13 16:34:12 2018
New Revision: 1824157

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

Fixes few remaining swallowed "catch NumberFormatException" in Groovy files

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy
    ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy
    ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy

Modified: ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy?rev=1824157&r1=1824156&r2=1824157&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy Tue Feb 13 16:34:12 2018
@@ -45,6 +45,7 @@ if (request.getParameter('createNew') ==
 
         } catch (NumberFormatException nfe) {
             Debug.log("Error parsing termIndex: ${termIndexStr}")
+            request.setAttribute("_ERROR_MESSAGE", "Error parsing termIndex: ${termIndexStr}")
         }
     }
 

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=1824157&r1=1824156&r2=1824157&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 Tue Feb 13 16:34:12 2018
@@ -41,6 +41,8 @@ import org.apache.ofbiz.entity.model.Mod
 import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAliasField
 import org.apache.ofbiz.product.inventory.*
 
+module = "CountFacilityInventoryByProduct"
+
 action = request.getParameter("action")
 
 searchParameterString = "action=Y&facilityId=" + facilityId
@@ -66,6 +68,8 @@ if (action) {
             hasOffsetQOH = true
             searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH
         } catch (NumberFormatException nfe) {
+            Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric")
         }
     }
     if (offsetATPQty) {
@@ -74,6 +78,8 @@ if (action) {
             hasOffsetATP = true
             searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP
         } catch (NumberFormatException nfe) {
+            Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric")
         }
     }
 
@@ -338,12 +344,12 @@ if (action) {
 
     } catch (GenericEntityException e) {
         errMsg = "Failure in operation, rolling back transaction"
-        Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct")
+        Debug.logError(e, errMsg, module)
         try {
             // only rollback the transaction if we started one...
             TransactionUtil.rollback(beganTransaction, errMsg, e)
         } catch (GenericEntityException e2) {
-            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct")
+            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module)
         }
         // after rolling back, rethrow the exception
         throw e

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=1824157&r1=1824156&r2=1824157&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 Tue Feb 13 16:34:12 2018
@@ -28,6 +28,7 @@ import org.apache.ofbiz.entity.model.Mod
 import org.apache.ofbiz.entity.util.EntityFindOptions
 import org.apache.ofbiz.product.inventory.*
 
+module = "ViewFacilityInventoryByProduct"
 action = request.getParameter("action")
 statusId = request.getParameter("statusId")
 searchParameterString = ""
@@ -52,6 +53,8 @@ if (action) {
             hasOffsetQOH = true
             searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH
         } catch (NumberFormatException nfe) {
+            Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric")
         }
     }
     if (offsetATPQty) {
@@ -60,6 +63,8 @@ if (action) {
             hasOffsetATP = true
             searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP
         } catch (NumberFormatException nfe) {
+            Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module)
+            request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric")
         }
     }
 
@@ -144,12 +149,12 @@ if (action) {
         prodsEli.close()
     } catch (GenericEntityException e) {
         errMsg = "Failure in operation, rolling back transaction"
-        Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct")
+        Debug.logError(e, errMsg, module)
         try {
             // only rollback the transaction if we started one...
             TransactionUtil.rollback(beganTransaction, errMsg, e)
         } catch (GenericEntityException e2) {
-            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct")
+            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module)
         }
         // after rolling back, rethrow the exception
         throw e