struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vic Cekvenich ...@basebeans.com>
Subject Re: ConcurrentModificationException in logoff
Date Thu, 27 Mar 2003 23:28:54 GMT
Take a look at this:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/org/apache/scaffoldingLib/memberSec/LogoutAct.java
.V

Mike Thompson wrote:
> you are removing items from a map you are iterating over.  That's a no no.
> 	--m
> 
> 
> -----Original Message-----
> From: awc [mailto:awc@drytel.net]
> 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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message