Mantis - Resin
Viewing Issue Advanced Details
1271 major always 07-28-06 12:55 08-21-06 15:55
planetpratt  
ferg  
normal  
closed 3.0.19  
fixed  
none    
none 3.0.21  
0001271: PageContext.removeAttribute(name,PageContext.PAGE_SCOPE) removes from ALL scopes
The implementation of com.caucho.jsp.PageContextImpl.removeAttribute(String,int) contains the following code:

    switch (scope) {
    case PAGE_SCOPE:
      removeAttribute(name);
      break;

Which improperly calls the PageContext.removeAttribute(String) method.

removeAttribute(String) is specifically defined in the JSP 2.0 spec to "Remove the object reference associated with the given name from all scopes."

Whereas removeAttribute(String,int) is defined to "Remove the object reference associated with the specified name in the given scope".

Since removeAttribute(String,int) calls removeAttribute(String) when it is passed PageContext.PAGE_SCOPE it removes the attribute from ALL scopes, not just the intended scope.
I believe by replacing the call to removeAttribute(name); on line 412 of PageContextImpl.java with:

if(name == null)
  throw new NullPointerException(L.l("removeAttribute must have a non-null name"));
_attributes.remove(name);

resin should once again be JSP 2.0 compliant.

N.B. The Exception message for removeAttribute(String) on line 318 incorrectly identifies itself as getAttribute.

Notes
(0001474)
ferg   
08-21-06 15:55   
server/162g