Or just use a Vector instead of an ArrayList, which is synchronized. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications
> From: Eduardo Dela Rosa <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <user@struts.apache.org> > Date: Wed, 27 Feb 2008 09:59:25 +1100 > To: Struts Users Mailing List <user@struts.apache.org> > Subject: Re: java.util.ConcurrentModificationException at IteratorComponent > > You are right there. And I guess the best way to rid this exception then is > to have the code part in synchronized block, i.e., synchronizing on the list > object itself + get the iterator + invoke either "add" or "remove" inside > the block. This will hurt the performance a bit BUT will preserve the > integrity of the content of the list. > > On Wed, Feb 27, 2008 at 9:50 AM, Dave Newton <[EMAIL PROTECTED]> wrote: > >> --- Eduardo Dela Rosa <[EMAIL PROTECTED]> wrote: >>> Also, you must be removing or updating object directly inside your list >>> object which is why you're getting this error. Try to get a reference to >>> Iterator from your ArrayList object and invoke "remove" or "add" methods >>> via the Iterator to get away from the ConcurrentModificationException. >> >> Strictly speaking I don't believe that's necessarily true; one can get a >> ConcurrentModificationException depending on how a map object is accessed >> in >> the iterator. >> >> (Not totally relevant since we're talking about lists, but thought I'd >> throw >> that out there.) >> >> Dave >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > Eduardo Dela Rosa This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]