I have a strange problem on BLC (2.1.1-SNAPSHOT) with demo site.
When i click on tab "Merchandise" i have the following error :
Code: Select all
ERROR] 11:13:06 TemplateEngine - [THYMELEAF][2] Exception processing template "catalog/category": Error during execution of processor 'org.broadleafcommerce.core.web.processor.ProductOptionsProcessor' (catalog/partials/productOptions:2)
janv. 09, 2013 11:13:06 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [mycompany] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.broadleafcommerce.core.web.processor.ProductOptionsProcessor' (catalog/partials/productOptions:2)] with root cause
java.lang.NullPointerException
at org.broadleafcommerce.core.web.processor.ProductOptionsProcessor.addAllProductOptionsToModel(ProductOptionsProcessor.java:112)
at org.broadleafcommerce.core.web.processor.ProductOptionsProcessor.modifyModelAttributes(ProductOptionsProcessor.java:74)
at org.broadleafcommerce.common.web.dialect.AbstractModelVariableModifierProcessor.processElement(AbstractModelVariableModifierProcessor.java:46)
at org.thymeleaf.processor.element.AbstractElementProcessor.doProcess(AbstractElementProcessor.java:74)
at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212)
at org.thymeleaf.dom.Node.applyNextProcessor(Node.java:896)
at org.thymeleaf.dom.Node.processNode(Node.java:858)
...
What i have done :
1/ I created a new Product into the category "Merchandise"
2/ This Product has a custom ProductOption (MyProductOption extends ProductOptionImpl) with a custom type (MyProductOptionType extends ProductOptionType) :
Code: Select all
public class MyProductOptionType extends ProductOptionType {
private static final long serialVersionUID = 1L;
public static final ProductOptionType CITY = new ProductOptionType("CITY", "city");
}
The error comes from ProductOptionsProcessor.addAllProductOptionsToModel, on the following line :
Code: Select all
dto.setType(option.getType().getType());
option.getType() return null.
So i tried to override the method getType() into MyProductOption :
Code: Select all
@Override
public ProductOptionType getType() {
return MyProductOptionType.getInstance(type);
}
But it's the same problem. Which is strange is that if i put a breakpoint on this method and start demo site in Debug it works but if i remove the breakpoint the error reappears. I don't understand why, im really stuck now.
Do you have any idea ?
Thanks in advance for your help