Wow! That was a really fast reply! Thanks!

Ok, that makes sense. I'll give that a try. Thanks for the insight.


Dave



> -----Original Message-----
> From: Viktor Szathmary [mailto:[EMAIL PROTECTED]
> Sent: 4 April 2005 11:27
> To: Tapestry users; [EMAIL PROTECTED]
> Subject: Re: java.util.ConcurrentModificationException
> 
> 
> Hi,
> 
> You have a Foreach that iterates thru your collection. The remove
> listener is invoked inside the Foreach. You will want to change your
> loop so it operates on a clone of the data, like so:
> 
>  <tr jwcid="@Foreach"
>        source="ognl:new ArrayList(terms)"
>        value="ognl:term"
>        element="tr">
> 
>   viktor
> 
> On Apr 3, 2005 10:23 PM, David Leangen <[EMAIL PROTECTED]> wrote:
> > 
> > Hi, Kent,
> > 
> > Thanks for the reply. (Comments below)
> > 
> > > > I have a table in which I use a Foreach to add rows.
> > > >
> > > > When I click on one of the buttons in the table, I am getting a
> > > > java.util.ConcurrentModificationException (full stack trace below).
> > >
> > > The collection is being modified while an iterator is iterating
> > > on it.
> > 
> > Yeah, I kinda figured that. Any ideas why this would be 
> happening, though?
> > 
> > Essentially, this is the kind of listener I have:
> > 
> >     public void onRemoveTerm(IRequestCycle cycle)
> >     {
> >         final int buttonNum = getSelectedButton().intValue();
> >         removeTerm(buttonNum);
> >     }
> > 
> > This is the template:
> > 
> > <tr jwcid="@Foreach"
> >       source="ognl:terms"
> >       value="ognl:term"
> >       element="tr">
> >   <td>Term:</td>
> >   <td><span jwcid="@Insert" value="ognl:term"/></td>
> >   <td><input jwcid="removeTermButton" type="submit" 
> value="Remove"/></td>
> > </tr>
> > 
> > And this is the component definition:
> > 
> >     <component id="removeTermButton" type="Submit">
> >       <binding name="listener" expression="listeners.onRemoveTerm"/>
> >       <binding name="tag" expression="removeButtonTag"/>
> >       <binding name="selected" expression="selectedButton"/>
> >     </component>
> > 
> > I hope that gives you enough information to get the idea.
> > 
> > I'm not quite understanding why concurrent access is happening 
> here, which
> > means I'm not able to understand how to solve the problem.
> > 
> > Any insights would be greatly appreciated!!!
> > 
> > Dave
> > 
> > 
> > ---------------------------------------------------------------------
> > 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