tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session StandardSession.java
Date Wed, 03 Jan 2001 00:17:09 GMT
craigmcc    01/01/02 16:17:09

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java
               catalina/src/share/org/apache/catalina/session
                        StandardSession.java
  Log:
  Do not fire "attributeRemoved" application events when the app tries to
  remove session or servlet context attributes that do not exist.
  
  PR: BugRat Bug Report #681.
  Submitted by:	Ramesh Mandava <Ramesh.Mandava@eng.sun.com>
  
  Revision  Changes    Path
  1.9       +12 -7     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ApplicationContext.java	2000/11/03 00:21:15	1.8
  +++ ApplicationContext.java	2001/01/03 00:17:06	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
1.8 2000/11/03 00:21:15 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/11/03 00:21:15 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
1.9 2001/01/03 00:17:06 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/01/03 00:17:06 $
    *
    * ====================================================================
    *
  @@ -100,7 +100,7 @@
    * associated with each instance of <code>StandardContext</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/11/03 00:21:15 $
  + * @version $Revision: 1.9 $ $Date: 2001/01/03 00:17:06 $
    */
   
   public final class ApplicationContext
  @@ -572,15 +572,20 @@
       public void removeAttribute(String name) {
   
           Object value = null;
  +        boolean found = false;
   
   	// Remove the specified attribute
   	synchronized (attributes) {
  -	    value = attributes.get(name);
  -	    attributes.remove(name);
  +            found = attributes.containsKey(name);
  +            if (found) {
  +                value = attributes.get(name);
  +                attributes.remove(name);
  +            } else {
  +                return;
  +            }
   	}
   
   	// Notify interested application event listeners
  -	// FIXME - Assumes we notify even if the attribute was not there?
   	Object listeners[] = context.getApplicationListeners();
   	if ((listeners == null) || (listeners.length == 0))
   	    return;
  
  
  
  1.9       +12 -7     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardSession.java	2000/11/03 00:21:17	1.8
  +++ StandardSession.java	2001/01/03 00:17:08	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
1.8 2000/11/03 00:21:17 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/11/03 00:21:17 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
1.9 2001/01/03 00:17:08 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/01/03 00:17:08 $
    *
    * ====================================================================
    *
  @@ -109,7 +109,7 @@
    * @author Craig R. McClanahan
    * @author Sean Legassick
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
  - * @version $Revision: 1.8 $ $Date: 2000/11/03 00:21:17 $
  + * @version $Revision: 1.9 $ $Date: 2001/01/03 00:17:08 $
    */
   
   final class StandardSession
  @@ -853,9 +853,15 @@
   
   	// Remove this attribute from our collection
   	Object value = null;
  +        boolean found = false;
   	synchronized (attributes) {
  -	    value = attributes.get(name);
  -	    attributes.remove(name);
  +            found = attributes.containsKey(name);
  +            if (found) {
  +                value = attributes.get(name);
  +                attributes.remove(name);
  +            } else {
  +                return;
  +            }
   	}
   
   	// Call the valueUnbound() method if necessary
  @@ -866,7 +872,6 @@
   	    ((HttpSessionBindingListener) value).valueUnbound(event);
   
   	// Notify interested application event listeners
  -	// FIXME - Assumes we notify even if the attribute was not there?
   	StandardContext context = (StandardContext) manager.getContainer();
   	Object listeners[] = context.getApplicationListeners();
   	if (listeners == null)
  
  
  

Mime
View raw message