random IllegalArgumentExcpetion with selectItems - convertEntity
evans Feb 25, 2009 10:36 PMI get an illegalArgumentException with my selectItems / convertEntity about 5% of the time when submitting the drop down box. I do not know how to reproduce it consistently. It can happen anytime during your session. I am using seam 2.1, jdk 1.5, and jboss 5. Below is the xhtml and the component that fills the skus list. Could someone please try to help? It is a very annoying problem and I can't figure out the cause.
<div class="productinfo"> <h2>#{currentProduct.shortDescription}</h2> <div class="description"> <h:outputText value="#{currentProduct.longDescription}" /> </div> <br/> <h:selectOneMenu id="selectSku" value="#{shoppingCart.newSku}"> <s:selectItems value="#{skus}" var="sku" label="#{skuAction.getFormattedSkuPrice(sku)} : #{sku.skuCode}"/> <s:convertEntity /> </h:selectOneMenu> Qty: <h:inputText size="3" value="#{shoppingCart.newQuantity}"/> </div> package com.acquitygroup.acquityondemand.session.catalog; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Out; import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.web.RequestParameter; import org.jboss.seam.log.Log; import static org.jboss.seam.ScopeType.PAGE; import static org.jboss.seam.ScopeType.SESSION; import com.acquitygroup.acquityondemand.entity.*; import java.util.List; import java.util.ArrayList; @Stateless @Name("productAction") public class ProductActionBean implements ProductAction { @Logger private Log log; @PersistenceContext private EntityManager em; @In(required=true) Site currentSite; @Out(required=false, scope=PAGE) private List<Product> productList; @In(required=false) @Out(required=false, scope=PAGE) Category theCategory; @Out(required=false) Product currentProduct; @Out(required=false, scope=SESSION) List<Sku> skus; Long productId; String siteId; @RequestParameter("catId") Long catId; public void setCurrentProductAndSkus() { currentProduct = em.find(Product.class, productId); skus = currentProduct.getSkuList(); }
And the exception:
Caused by: java.lang.IllegalArgumentException
at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:179)
at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:61)
at javax.faces.component.SelectUtils.matchValue(SelectUtils.java:82)
at javax.faces.component.UISelectOne.validateValue(UISelectOne.java:144)
at javax.faces.component.UIInput.validate(UIInput.java:875)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
at javax.faces.component.UIInput.processValidators(UIInput.java:672)
at javax.faces.component.UIForm.processValidators(UIForm.java:235)
at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)