pierred     00/11/20 16:02:24

  Modified:    jasper/src/share/org/apache/jasper/runtime
                        PageContextImpl.java
  Log:
  Fix for bug report #412:
    public void removeAttribute(String name) does not work properly
  
  - removeAttribute now removes the attribute from the 4 scopes.
  - REQUEST_SCOPE now handled properly.
  
  Revision  Changes    Path
  1.6       +14 -7     
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java
  
  Index: PageContextImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PageContextImpl.java      2000/11/14 01:04:23     1.5
  +++ PageContextImpl.java      2000/11/21 00:02:23     1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
 1.5 2000/11/14 01:04:23 pierred Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/11/14 01:04:23 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
 1.6 2000/11/21 00:02:23 pierred Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/11/21 00:02:23 $
    *
    * ====================================================================
    *
  @@ -93,11 +93,10 @@
   /**
    * Implementation of the PageContext class from the JSP spec.
    *
  - * The removeAttribute method does not work for request scope. Needs fixing.
  - *
    * @author Anil K. Vijendran
    * @author Larry Cable
    * @author Hans Bergsten
  + * @author Pierre Delisle
    */
   public class PageContextImpl extends PageContext {
   
  @@ -302,7 +301,7 @@
            break;
   
            case REQUEST_SCOPE:
  -             throw new IllegalArgumentException("cant remove Attributes from 
request scope");
  +             request.removeAttribute(name);
   
            case SESSION_SCOPE:
                if (session == null)
  @@ -383,7 +382,15 @@
       }
   
       public void removeAttribute(String name) {
  -     attributes.remove(name);
  +     try {
  +         removeAttribute(name, PAGE_SCOPE);
  +         removeAttribute(name, REQUEST_SCOPE);
  +         removeAttribute(name, SESSION_SCOPE);
  +         removeAttribute(name, APPLICATION_SCOPE);
  +     } catch (Exception ex) {
  +         // we remove as much as we can, and
  +         // simply ignore possible exceptions
  +     }
       }
   
       public JspWriter getOut() {
  
  
  

Reply via email to