svn commit: r1817651 - in /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing: PackingServices.java PackingSession.java

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

svn commit: r1817651 - in /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing: PackingServices.java PackingSession.java

mbrohl
Author: mbrohl
Date: Sat Dec  9 18:09:58 2017
New Revision: 1817651

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

Thanks Julian Leichert for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java?rev=1817651&r1=1817650&r2=1817651&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java Sat Dec  9 18:09:58 2017
@@ -138,7 +138,7 @@ public class PackingServices {
                 String[] weights;
 
                 // process the package array
-                if (pkgStr.indexOf(",") != -1) {
+                if (pkgStr.indexOf(',') != -1) {
                     // this is a multi-box update
                     packages = pkgStr.split(",");
                 } else {
@@ -146,7 +146,7 @@ public class PackingServices {
                 }
 
                 // check to make sure there is at least one package
-                if (packages == null || packages.length == 0) {
+                if (packages.length == 0) {
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                             "ProductPackBulkNoPackagesDefined", locale));
                 }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java?rev=1817651&r1=1817650&r2=1817651&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java Sat Dec  9 18:09:58 2017
@@ -184,6 +184,9 @@ public class PackingSession implements j
                     case 0:
                         Debug.logInfo("Packing check returned '0' - doing nothing.", module);
                         break;
+                default:
+                    Debug.logInfo("Packing check returned '> 2' or '< 0'", module);
+                    break;
                 }
             }
 
@@ -238,6 +241,9 @@ public class PackingSession implements j
                 String invItemId = res.getString("inventoryItemId");
                 packLines.add(new PackingSessionLine(orderId, orderItemSeqId, shipGroupSeqId, productId, invItemId, quantity, weight, packageSeqId));
                 break;
+        default:
+            throw new GeneralException("value of checkCode different than expected");
+
         }
 
         // Add the line weight to the package weight