You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ar...@apache.org on 2015/06/20 17:30:46 UTC

svn commit: r1686642 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java

Author: arunpatidar
Date: Sat Jun 20 15:30:45 2015
New Revision: 1686642

URL: http://svn.apache.org/r1686642
Log:
Fixed the code to handle NPE on adding config products to cart. Need to verify further process after this fix.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java?rev=1686642&r1=1686641&r2=1686642&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java Sat Jun 20 15:30:45 2015
@@ -329,6 +329,7 @@ public class ProductConfigWorker {
                 configItemId = ci.getConfigItemAssoc().getString("configItemId");
                 sequenceNum = ci.getConfigItemAssoc().getLong("sequenceNum");
                 for (ConfigOption oneOption: selectedOptions) {
+                    Map<String, String>  componentOptions = oneOption.componentOptions;
                     List<GenericValue> toBeStored = new LinkedList<GenericValue>();
                     String configOptionId = oneOption.configOption.getString("configOptionId");
                     String description = oneOption.getComments();
@@ -343,8 +344,8 @@ public class ProductConfigWorker {
                     if (oneOption.hasVirtualComponent()) {
                         List<GenericValue> components = oneOption.getComponents();
                         for (GenericValue component: components) {
-                            if (oneOption.isVirtualComponent(component)) {
-                                String componentOption = oneOption.componentOptions.get(component.getString("productId"));
+                            if (oneOption.isVirtualComponent(component) && UtilValidate.isNotEmpty(componentOptions)) {
+                            	String  componentOption = componentOptions.get(component.getString("productId"));
                                 GenericValue configOptionProductOption = delegator.makeValue("ConfigOptionProductOption");
                                 configOptionProductOption.put("configId", configId);
                                 configOptionProductOption.put("configItemId", configItemId);