On EJbPostCreate I get an
"IndexOutOfBoundsexception: Index: 0, Size: 0"
The following is the complete EjbPostCreate method code that fails:
public void ejbPostCreate(StatusLocal statusLocal, Long userId) throws javax.ejb.CreateException, ApplicationException { Iterator relations; relations = statusLocal.getReasons().iterator(); while (relations.hasNext()) { ReasonLocal reasonLocal = (ReasonLocal) relations.next(); ReasonLocalHome reasonLocalHome = (ReasonLocalHome) reasonLocal.getEJBLocalHome(); this.getReasons().add(reasonLocalHome.create(reasonLocal, userId)); } }
relations = statusLocal.getReasons().iterator();
java.lang.IndexOutOfBoundsException: Index:0, Size:0 at java.util.ArrayList.RangeCheck(ArrayList.java:546) at java.util.ArrayList.get(ArrayList.java:321) at com.emi.framework.bo.model.StatusBean.ejbPostCreate(StatusBean.java:120) ...
It's neither a bug in java or jboss, you shouldn't alternate a collection while running over it with an iterator.
dirk