Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > [NEWBIE]ConcurrentModificationException

Reply
Thread Tools

[NEWBIE]ConcurrentModificationException

 
 
Federico
Guest
Posts: n/a
 
      07-21-2003
Hi all,

I'm writing a servlet for the management of a mailing list.


The Mailing list is an html page with an attacchment where the
personal data (email, name, title) are taken from an XML file using
the JDOM API, in which I navigate using the the "Iterator" Object .


For giving the possibily of erasing from the mailing list there in the
HTML page sent by mail there is a link where one can go to a servlet
with the email address passed as a parameter. This parameter is used
to retrieve the rest of the information (name and title) using again
the "iterator" object in the JDOM tree obtained from the same XML
file. (step 1)

Once all the information are retrieved, they are showed in a web page,
asking the confirmation for the deleting. This confirmation is a call
to another servlet always with the email address passed as a
parameter. (step 2)

In this last servlet the JDOM tree is "iterated" again to find the
correspondence with the email address parameter and the element which
contain it, so this element could be erased (with all the related
data). (step 3)

Now the problem is that when I pass from the step 2 to the step 3,
when the last servlet is called I receive this error:


description The server encountered an internal error () that prevented
it from fulfilling this request.

java.util.ConcurrentModificationException
at
org.jdom.ContentList$FilterListIterator.checkConcu rrentModification(ContentList.java:1230)
at
org.jdom.ContentList$FilterListIterator.hasNext(Co ntentList.java:942)
at
DeleteAddressServlet.processRequest(DeleteAddressS ervlet.java:50)
at DeleteAddressServlet.doPost(DeleteAddressServlet.j ava:141)
at

etc. etc. etc.

It seems that I can't call again an Iterator on the same file from the
second servlet to the third because Tomcat says that you can't modify
a file from two servlet at the same time.

How can I evade this?

I've tried to call another iterator object but it doesn't work. There
is a way to "close" a file from the second servlet to the third, so
not to have this exception?

Thank you
Federico
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments