Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[NEWBIE]ConcurrentModificationException

1 view
Skip to first unread message

Federico

unread,
Jul 21, 2003, 12:06:10 PM7/21/03
to
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

0 new messages