you are removing items from a map you are iterating over.  That's a no no.
        --m


-----Original Message-----
From: awc [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 5:15 PM
To: Struts Users Mailing List
Subject: ConcurrentModificationException in logoff


Hi All,

In log off action, I have code like this...

 Enumeration enum = session.getAttributeNames();
 while(enum.hasMoreElements())
 {
  String att = (String)enum.nextElement();
     session.removeAttribute( att );
   }
 session.invalidate();
 return (mapping.findForward(Constants.ROOT));

I guess I am taking off something struts need too. I get exception like
this...

java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:762)
        at java.util.HashMap$KeyIterator.next(HashMap.java:798)
        at
org.apache.catalina.util.Enumerator.nextElement(Enumerator.java:166)
        at ca.awcl.struts.user.LogoffAction.execute(Unknown Source)
        at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)

        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

        .........

If  I comment out

Enumeration enum = session.getAttributeNames();
 while(enum.hasMoreElements())
 {
  String att = (String)enum.nextElement();
     session.removeAttribute( att );
   }

I do not get the Exception....

any ideas... Or how do I log off tomcat-apache cleanly..

or is it good idea to just invalidate the session when you log off??

Thanks

.anil

This is on struts-1.1b3 with tomcat 4.1.18 with sun java-1.4.1_01_b01 on
Redhat Linux 7.3.





---------------------------------------------------------------------
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