[NEWBIE]ConcurrentModificationException

F

Federico

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.checkConcurrentModification(ContentList.java:1230)
at
org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:942)
at
DeleteAddressServlet.processRequest(DeleteAddressServlet.java:50)
at DeleteAddressServlet.doPost(DeleteAddressServlet.java: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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top