You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/05/25 17:06:17 UTC

svn commit: r659995 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Author: jleroux
Date: Sun May 25 08:06:16 2008
New Revision: 659995

URL: http://svn.apache.org/viewvc?rev=659995&view=rev
Log:
Fix a NPE on maySplit and a potential one on isGift

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=659995&r1=659994&r2=659995&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sun May 25 08:06:16 2008
@@ -2235,7 +2235,9 @@
 
     public void setMaySplit(int idx, Boolean maySplit) {
         CartShipInfo csi = this.getShipInfo(idx);
-        csi.maySplit = maySplit.booleanValue() ? "Y" : "N";
+        if (UtilValidate.isNotEmpty(maySplit)) {
+            csi.maySplit = maySplit.booleanValue() ? "Y" : "N";
+        }
     }
 
     public void setMaySplit(Boolean maySplit) {
@@ -2272,7 +2274,9 @@
 
     public void setIsGift(int idx, Boolean isGift) {
         CartShipInfo csi = this.getShipInfo(idx);
-        csi.isGift = isGift.booleanValue() ? "Y" : "N";
+        if (UtilValidate.isNotEmpty(isGift)) {
+            csi.isGift = isGift.booleanValue() ? "Y" : "N";
+        }
     }
 
     public void setIsGift(Boolean isGift) {
@@ -3914,7 +3918,7 @@
             CartShipInfo csi = (CartShipInfo) shipInfo.get(i);
             if ((csi.supplierPartyId == null && supplierPartyId == null) ||
                 (UtilValidate.isNotEmpty(csi.supplierPartyId) && csi.supplierPartyId.equals(supplierPartyId))) {
-                shipGroups.put(new Integer(i), csi);
+                    shipGroups.put(new Integer(i), csi);
             }
         }
         return shipGroups;
@@ -3951,7 +3955,9 @@
             
             // Ignore ship groups that are already drop shipped
             String shipGroupSupplierPartyId = shipInfo.getSupplierPartyId();
-            if (UtilValidate.isNotEmpty(shipGroupSupplierPartyId)) continue;
+            if (UtilValidate.isNotEmpty(shipGroupSupplierPartyId)) { 
+                continue;
+            }
 
             // Ignore empty ship groups
             Set shipItems = shipInfo.getShipItems();