Buggy code:
public class RelationSet implements Set { private JDBCCMRFieldBridge cmrField ; private CmpEntityBeanContext ctx ; private List [ ] setHandle ; private boolean readOnly ; private Class relatedLocalInterface ; public RelationSet ( JDBCCMRFieldBridge cmrField , CmpEntityBeanContext ctx , List [ ] setHandle , boolean readOnly ) { } private List getIdList ( ) { } public int size ( ) { } public boolean isEmpty ( ) { } public boolean add ( Object o ) { } public boolean addAll ( Collection c ) { } public boolean remove ( Object o ) { } public boolean removeAll ( Collection c ) { } public void clear ( ) { } public boolean retainAll ( Collection c ) { } public boolean contains ( Object o ) { } public boolean containsAll ( Collection c ) { } public Object [ ] toArray ( Object [ ] a ) { } public Object [ ] toArray ( ) { } private static void checkForPKChange ( ) { } public Iterator iterator ( ) { return new Iterator ( ) { private final Iterator idIterator = getIdList ( ) . iterator ( ) ; private Object currentId ; public boolean hasNext ( ) { verifyIteratorIsValid ( ) ; try { return idIterator . hasNext ( ) ; } catch ( ConcurrentModificationException e ) { throw new IllegalStateException ( ( "Underlying<seq2seq4repair_space>collection<seq2seq4repair_space>has<seq2seq4repair_space>" + "been<seq2seq4repair_space>modified" ) ) ; } } public Object next ( ) { verifyIteratorIsValid ( ) ; try { currentId = idIterator . next ( ) ; <START_BUG> return cmrField . getRelatedComponent ( ) . getEjbLocalObject ( currentId ) ; <END_BUG> } catch ( ConcurrentModificationException e ) { throw new IllegalStateException ( ( "Underlying<seq2seq4repair_space>collection<seq2seq4repair_space>has<seq2seq4repair_space>" + "been<seq2seq4repair_space>modified" ) ) ; } } public void remove ( ) { verifyIteratorIsValid ( ) ; if ( readOnly ) { throw new EJBException ( "This<seq2seq4repair_space>collection<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>read-only<seq2seq4repair_space>snapshot" ) ; } if ( cmrField . isReadOnly ( ) ) { throw new EJBException ( ( "Field<seq2seq4repair_space>is<seq2seq4repair_space>read-only:<seq2seq4repair_space>" + ( cmrField . getFieldName ( ) ) ) ) ; } RelationSet . checkForPKChange ( ) ; try { idIterator . remove ( ) ; cmrField . destroyRelationLinks ( ctx , currentId , false ) ; } catch ( ConcurrentModificationException e ) { throw new IllegalStateException ( "Underlying<seq2seq4repair_space>collection<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>modified" ) ; } } private void verifyIteratorIsValid ( ) { if ( ( setHandle [ 0 ] ) == null ) { throw new IllegalStateException ( ( "The<seq2seq4repair_space>iterator<seq2seq4repair_space>of<seq2seq4repair_space>a<seq2seq4repair_space>CMR<seq2seq4repair_space>" + ( "collection<seq2seq4repair_space>may<seq2seq4repair_space>only<seq2seq4repair_space>be<seq2seq4repair_space>used<seq2seq4repair_space>within<seq2seq4repair_space>the<seq2seq4repair_space>transction<seq2seq4repair_space>in<seq2seq4repair_space>" + "which<seq2seq4repair_space>it<seq2seq4repair_space>was<seq2seq4repair_space>created" ) ) ) ; } } } ; } public String toString ( ) { } private Object getPrimaryKey ( EJBLocalObject o ) { } }

Fix:
return cmrField . getRelatedComponent ( ) . getEJBLocalObject ( currentId ) ;