[OFBiz] SVN: r7555 - trunk/applications/order/src/org/ofbiz/order/shoppingcart

jacopo@svn.ofbiz.org jacopo at svn.ofbiz.org
Wed May 10 02:24:30 CDT 2006


Author: jacopo
Date: 2006-05-10 02:24:24 -0500 (Wed, 10 May 2006)
New Revision: 7555

Modified:
   trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
Log:
Fixed NPE when orderType is null; thanks to Ruth Hoffman for the bug report.

Modified: trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java	2006-05-10 00:54:29 UTC (rev 7554)
+++ trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java	2006-05-10 07:24:24 UTC (rev 7555)
@@ -1294,12 +1294,14 @@
     /** Returns the item type description. */
     public String getItemTypeDescription() {
         GenericValue orderItemType = null;
-        try {
-            orderItemType = this.getDelegator().findByPrimaryKeyCache("OrderItemType", UtilMisc.toMap("orderItemTypeId", this.getItemType()));
-        } catch (GenericEntityException e) {
-            Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsGettingOrderItemTypeFor", UtilMisc.toMap("orderItemTypeId",this.getItemType()), locale));
+        if (this.getItemType() != null) {
+            try {
+                orderItemType = this.getDelegator().findByPrimaryKeyCache("OrderItemType", UtilMisc.toMap("orderItemTypeId", this.getItemType()));
+            } catch (GenericEntityException e) {
+                Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsGettingOrderItemTypeFor", UtilMisc.toMap("orderItemTypeId",this.getItemType()), locale));
+            }
         }
-        if (itemType != null) {
+        if (orderItemType != null) {
             return orderItemType.getString("description");
         }
         return null;



More information about the Svn mailing list