You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2004/02/12 21:54:21 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session LocalStrings.properties StandardSession.java

markt       2004/02/12 12:54:21

  Modified:    catalina/src/share/org/apache/catalina/session
                        LocalStrings.properties StandardSession.java
  Log:
  Fix bug 14283. Catch and log exceptions in listeners. Reported by Eddie Ruvinsky. Ported from TC4.
  
  Revision  Changes    Path
  1.5       +1 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/LocalStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalStrings.properties	9 Jan 2004 11:35:08 -0000	1.4
  +++ LocalStrings.properties	12 Feb 2004 20:54:21 -0000	1.5
  @@ -35,6 +35,7 @@
   standardManager.managerLoad=Exception loading sessions from persistent storage
   standardManager.managerUnload=Exception unloading sessions to persistent storage
   standardSession.attributeEvent=Session attribute event listener threw exception
  +standardSession.bindingEvent=Session binding event listener threw exception
   standardSession.invalidate.ise=invalidate: Session already invalidated
   standardSession.isNew.ise=isNew: Session already invalidated
   standardSession.getAttribute.ise=getAttribute: Session already invalidated
  
  
  
  1.34      +19 -11    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StandardSession.java	26 Jan 2004 19:47:48 -0000	1.33
  +++ StandardSession.java	12 Feb 2004 20:54:21 -0000	1.34
  @@ -633,7 +633,7 @@
           this.lastAccessedTime = this.thisAccessedTime;
           this.thisAccessedTime = System.currentTimeMillis();
   
  -	evaluateIfValid();
  +        evaluateIfValid();
   
           accessCount++;
   
  @@ -1256,7 +1256,11 @@
           // Call the valueBound() method if necessary
           if (value instanceof HttpSessionBindingListener) {
               event = new HttpSessionBindingEvent(this, name, value);
  -            ((HttpSessionBindingListener) value).valueBound(event);
  +            try {
  +                ((HttpSessionBindingListener) value).valueBound(event);
  +            } catch (Throwable t){
  +                log(sm.getString("standardSession.bindingEvent"), t); 
  +            }
           }
   
           // Replace or add this attribute
  @@ -1265,8 +1269,12 @@
           // Call the valueUnbound() method if necessary
           if ((unbound != null) &&
               (unbound instanceof HttpSessionBindingListener)) {
  -            ((HttpSessionBindingListener) unbound).valueUnbound
  -                (new HttpSessionBindingEvent(this, name));
  +            try {
  +                ((HttpSessionBindingListener) unbound).valueUnbound
  +                    (new HttpSessionBindingEvent(this, name));
  +            } catch (Throwable t) {
  +                log(sm.getString("standardSession.bindingEvent"), t);
  +            }
           }
   
           // Notify interested application event listeners
  @@ -1454,9 +1462,9 @@
   
       protected void evaluateIfValid() {
           /*
  -	 * If this session has expired or is in the process of expiring or
  -	 * will never expire, return
  -	 */
  +     * If this session has expired or is in the process of expiring or
  +     * will never expire, return
  +     */
           if (!this.isValid || expiring || maxInactiveInterval < 0)
               return;
   
  
  
  

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