You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Tom Rodriguez <tr...@parc.xerox.com> on 1999/11/12 03:25:33 UTC

PATCH: PageContextImpl.findAttribute

Here's a small fix for PageContextImpl which throws an exception when
findAttribute can't find a name.  The new code also only looks up the
value once instead of twice.

tom

Index: src/share/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
retrieving revision 1.3
diff -c -r1.3 PageContextImpl.java
*** PageContextImpl.java	1999/10/17 22:21:32	1.3
--- PageContextImpl.java	1999/11/12 02:23:33
***************
*** 269,275 ****
      }
  
      public Object findAttribute(String name) {
!         return getAttribute(name, getAttributesScope(name));
      }
  
  
--- 269,289 ----
      }
  
      public Object findAttribute(String name) {
! 	Object o = attributes.get(name);
! 	if (o != null)
! 	    return o;
! 
! 	o = request.getAttribute(name);
! 	if (o != null)
! 	    return o;
! 
! 	if (session != null) {
! 	    o = session.getAttribute(name);
! 	    if (o != null)
! 		return o;
! 	}
! 
! 	return context.getAttribute(name);
      }