Fixed: Issue in function getVariantSelectionFeatures of ProductWorker.java
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
@@ -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
