svn commit: r1787918 - in /ofbiz/branches/release16.11: ./ applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java

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

svn commit: r1787918 - in /ofbiz/branches/release16.11: ./ applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java

jleroux@apache.org
Author: jleroux
Date: Tue Mar 21 09:21:19 2017
New Revision: 1787918

URL: http://svn.apache.org/viewvc?rev=1787918&view=rev
Log:
"Applied fix from trunk framework for revision: 1787911"
------------------------------------------------------------------------
r1787911 | jleroux | 2017-03-21 10:14:19 +0100 (mar. 21 mars 2017) | 1 ligne

No functional changes, removes useless swallowed exceptions, refactors
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release16.11/   (props changed)
    ofbiz/branches/release16.11/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java

Propchange: ofbiz/branches/release16.11/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 21 09:21:19 2017
@@ -10,5 +10,5 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047,1787133,1787176,1787535,1787627,1787823,1787906-1787910
+/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047,1787133,1787176,1787535,1787627,1787823,1787906-1787911
 /ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935,1772346,1772880,1774772,1775441,1779724,1780659,1781109,1781125,1781979,1782498,1782520

Modified: ofbiz/branches/release16.11/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release16.11/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java?rev=1787918&r1=1787917&r2=1787918&view=diff
==============================================================================
--- ofbiz/branches/release16.11/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/branches/release16.11/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java Tue Mar 21 09:21:19 2017
@@ -294,94 +294,71 @@ public class ShipmentServices {
         List<GenericValue> estimateList = new LinkedList<GenericValue>();
 
         for (GenericValue thisEstimate: estimates) {
-            String toGeo = thisEstimate.getString("geoIdTo");
-            if (UtilValidate.isNotEmpty(toGeo) && shipAddress ==null) {
-                // This estimate requires shipping address details. We don't have it so we cannot use this estimate.
-                continue;
-            }
-            List<GenericValue> toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator);
-            // Make sure we have a valid GEOID.
-            if (UtilValidate.isEmpty(toGeoList) ||
-                    GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) ||
-                    GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) ||
-                    GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) {
-
-                GenericValue wv = null;
-                GenericValue qv = null;
-                GenericValue pv = null;
-
-                try {
-                    wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false);
-                } catch (GenericEntityException e) {
-                }
-                try {
-                    qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false);
-                } catch (GenericEntityException e) {
-                }
-                try {
-                    pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false);
-                } catch (GenericEntityException e) {
+            try {
+                String toGeo = thisEstimate.getString("geoIdTo");
+                if (UtilValidate.isNotEmpty(toGeo) && shipAddress ==null) {
+                    // This estimate requires shipping address details. We don't have it so we cannot use this estimate.
+                    continue;
                 }
-                if (wv == null && qv == null && pv == null) {
-                    estimateList.add(thisEstimate);
-                } else {
-                    // Do some testing.
-                    boolean useWeight = false;
-                    boolean weightValid = false;
-                    boolean useQty = false;
-                    boolean qtyValid = false;
-                    boolean usePrice = false;
-                    boolean priceValid = false;
-
-                    if (wv != null) {
-                        useWeight = true;
-                        BigDecimal min = BigDecimal.ONE.movePointLeft(4);
-                        BigDecimal max = BigDecimal.ONE.movePointLeft(4);
-
-                        try {
+                List<GenericValue> toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator);
+                // Make sure we have a valid GEOID.
+                if (UtilValidate.isEmpty(toGeoList) ||
+                        GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) ||
+                        GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) ||
+                        GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) {
+                    GenericValue wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false);
+                    GenericValue qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false);
+                    GenericValue pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false);
+                    if (wv == null && qv == null && pv == null) {
+                        estimateList.add(thisEstimate);
+                    } else {
+                        // Do some testing.
+                        boolean useWeight = false;
+                        boolean weightValid = false;
+                        boolean useQty = false;
+                        boolean qtyValid = false;
+                        boolean usePrice = false;
+                        boolean priceValid = false;
+
+                        if (wv != null) {
+                            useWeight = true;
+                            BigDecimal min = BigDecimal.ONE.movePointLeft(4);
+                            BigDecimal max = BigDecimal.ONE.movePointLeft(4);
                             min = wv.getBigDecimal("fromQuantity");
                             max = wv.getBigDecimal("thruQuantity");
-                        } catch (Exception e) {
-                        }
-                        if (shippableWeight.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableWeight.compareTo(max) <= 0)) {
-                            weightValid = true;
-                        }
-                    }
-                    if (qv != null) {
-                        useQty = true;
-                        BigDecimal min = BigDecimal.ONE.movePointLeft(4);
-                        BigDecimal max = BigDecimal.ONE.movePointLeft(4);
-
-                        try {
+                            if (shippableWeight.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableWeight.compareTo(max) <= 0)) {
+                                weightValid = true;
+                            }
+                        }
+                        if (qv != null) {
+                            useQty = true;
+                            BigDecimal min = BigDecimal.ONE.movePointLeft(4);
+                            BigDecimal max = BigDecimal.ONE.movePointLeft(4);
                             min = qv.getBigDecimal("fromQuantity");
                             max = qv.getBigDecimal("thruQuantity");
-                        } catch (Exception e) {
-                        }
-                        if (shippableQuantity.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableQuantity.compareTo(max) <= 0)) {
-                            qtyValid = true;
-                        }
-                    }
-                    if (pv != null) {
-                        usePrice = true;
-                        BigDecimal min = BigDecimal.ONE.movePointLeft(4);
-                        BigDecimal max = BigDecimal.ONE.movePointLeft(4);
-
-                        try {
+                            if (shippableQuantity.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableQuantity.compareTo(max) <= 0)) {
+                                qtyValid = true;
+                            }
+                        }
+                        if (pv != null) {
+                            usePrice = true;
+                            BigDecimal min = BigDecimal.ONE.movePointLeft(4);
+                            BigDecimal max = BigDecimal.ONE.movePointLeft(4);
                             min = pv.getBigDecimal("fromQuantity");
                             max = pv.getBigDecimal("thruQuantity");
-                        } catch (Exception e) {
-                        }
-                        if (shippableTotal.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableTotal.compareTo(max) <= 0)) {
-                            priceValid = true;
+                            if (shippableTotal.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableTotal.compareTo(max) <= 0)) {
+                                priceValid = true;
+                            }
+                        }
+                        // Now check the tests.
+                        if ((useWeight && weightValid) || (useQty && qtyValid) || (usePrice && priceValid)) {
+                            estimateList.add(thisEstimate);
                         }
                     }
-                    // Now check the tests.
-                    if ((useWeight && weightValid) || (useQty && qtyValid) || (usePrice && priceValid)) {
-                        estimateList.add(thisEstimate);
-                    }
                 }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, e.getLocalizedMessage(), module);
             }
-
         }
 
         if (estimateList.size() < 1) {