When I search for laptops and only select weight as a specification, I get a null pointer exception. I'm assuming this is because not all products have a weight, and the logic is attempting to sort all products by their weight even if they don't have one.
Here is the line which throws the null pointer:
if(pProductList.get(j).getAttribute(pAttrId).getTypedValue().getNumeric() < pProductList.get(j-1).getAttribute(pAttrId).getTypedValue().getNumeric())
and here is the stack trace:
java.lang.NullPointerException: null at ca.mcgill.cs.creco.util.RankedFeaturesProducts.directionSensitiveProductSort(RankedFeaturesProducts.java:169) at ca.mcgill.cs.creco.util.RankedFeaturesProducts.FeatureSensitiveRanking(RankedFeaturesProducts.java:85) at ca.mcgill.cs.creco.web.controller.SearchController.sendCurrentFeatureList(SearchController.java:623)
When I search for laptops and only select weight as a specification, I get a null pointer exception. I'm assuming this is because not all products have a weight, and the logic is attempting to sort all products by their weight even if they don't have one.
Here is the line which throws the null pointer:
if(pProductList.get(j).getAttribute(pAttrId).getTypedValue().getNumeric() < pProductList.get(j-1).getAttribute(pAttrId).getTypedValue().getNumeric())
and here is the stack trace:
java.lang.NullPointerException: null at ca.mcgill.cs.creco.util.RankedFeaturesProducts.directionSensitiveProductSort(RankedFeaturesProducts.java:169) at ca.mcgill.cs.creco.util.RankedFeaturesProducts.FeatureSensitiveRanking(RankedFeaturesProducts.java:85) at ca.mcgill.cs.creco.web.controller.SearchController.sendCurrentFeatureList(SearchController.java:623)