svn commit: r1859255 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java

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

svn commit: r1859255 - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java

adityasharma
Author: adityasharma
Date: Wed May 15 05:07:48 2019
New Revision: 1859255

URL: http://svn.apache.org/viewvc?rev=1859255&view=rev
Log:
Fixed: Issue in function getVariantSelectionFeatures of ProductWorker.java
(OFBIZ-11029)
Check should be isVirtual instead of productId. Also handled a NullPointerException for variantProduct.
Thanks Denglong Zhou for reporting the issue, Pawan Verma for the patch and Suraj Khurana & Jacques Le Roux for the review

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java?rev=1859255&r1=1859254&r2=1859255&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java Wed May 15 05:07:48 2019
@@ -483,11 +483,11 @@ public final class ProductWorker {
      * @return a List of ProductFeature GenericValues
      */
     public static List<GenericValue> getVariantSelectionFeatures(GenericValue variantProduct) {
-        if (!"Y".equals(variantProduct.getString("isVariant"))) {
+        if (variantProduct == null || !"Y".equals(variantProduct.getString("isVariant"))) {
             return null;
         }
         GenericValue virtualProduct = ProductWorker.getParentProduct(variantProduct.getString("productId"), variantProduct.getDelegator());
-        if (virtualProduct == null || !"Y".equals(virtualProduct.getString("productId"))) {
+        if (virtualProduct == null || !"Y".equals(virtualProduct.getString("isVirtual"))) {
             return null;
         }
         // The selectable features from the virtual product