Do you really want to put the current Post object back into the postList
(which is what's causing a CME)?  Are you attempting to make postList
basically a concatenation of itself?  

-----Original Message-----
From: Nima Boustanian [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 20, 2006 11:47 AM
To: Tapestry users
Subject: java.util.ConcurrentModificationException

Hey all

I keep getting this java.util.ConcurrentModificationException when I try 
to add rows to a table. The below code won't
work, but if I remove the For loop and just add "result.add(new 
ConversationsPlaceHolderTable("test")); it will output
"test" as the first row in my table. I Googled a bit and found a post by 
Kent Tong saying that this probably is because I am
trying to modify a collection while an iterator is trying to iterate 
over it, but I can't figure out how this should be resolved in my 
IBasicTableModel
class. Any ideas?

 public Iterator getCurrentPageRows(int firstRow, int rowsPerPage,
           ITableColumn sortColumn, boolean sortOrder) {
      
        List result = new ArrayList();
      
        for (Iterator it = postList.iterator(); it.hasNext(); ) {
            Post post = (Post)it.next();
            postList.add(post);
            result.add(new ConversationsPlaceHolderTable(post.getTitle()));
        }
       
        return result.iterator();
    }

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to