svn commit: r1817691 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java

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

svn commit: r1817691 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java

mbrohl
Author: mbrohl
Date: Sun Dec 10 10:52:37 2017
New Revision: 1817691

URL: http://svn.apache.org/viewvc?rev=1817691&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.shipment.weightPackage.
(OFBIZ-9822)

Thanks Dennis Balkir for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1817691&r1=1817690&r2=1817691&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java Sun Dec 10 10:52:37 2017
@@ -303,7 +303,7 @@ public class WeightPackageSession implem
         //create the package(s)
         this.createPackages(orderId);
         // calculate the actual shipping charges according to package(s) weight and dimensions
-        BigDecimal actualShippingCost = ZERO;
+        BigDecimal actualShippingCost;
         // Check if UPS integration is done
         if ("UPS".equals(this.carrierPartyId) && "Y".equals(calculateOnlineShippingRateFromUps)) {
             // call upsShipmentConfirm service, it will calculate the online shipping rate from UPS and save in ShipmentRouteSegment entity in actualCost field
@@ -389,7 +389,7 @@ public class WeightPackageSession implem
     protected boolean diffInShipCost(BigDecimal actualShippingCost) throws GeneralException {
         BigDecimal estimatedShipCost = this.getEstimatedShipCost();
         BigDecimal doEstimates = new BigDecimal(UtilProperties.getPropertyValue("shipment", "shipment.default.cost_actual_over_estimated_percent_allowed", "10"));
-        BigDecimal diffInShipCostInPerc = ZERO;
+        BigDecimal diffInShipCostInPerc;
         if (estimatedShipCost.compareTo(ZERO) == 0) {
             diffInShipCostInPerc = actualShippingCost;
         } else {
@@ -418,7 +418,7 @@ public class WeightPackageSession implem
             shipmentPackageMap.put("weightUomId", getWeightUomId());
             shipmentPackageMap.put("userLogin", userLogin);
 
-            Map<String, Object> shipmentPackageResult = new HashMap<String, Object>();
+            Map<String, Object> shipmentPackageResult;
             GenericValue shipmentPackage = this.getDelegator().findOne("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId), false);
             if (UtilValidate.isEmpty(shipmentPackage)) {
                 shipmentPackageResult = this.getDispatcher().runSync("createShipmentPackage", shipmentPackageMap);