luehe       2003/02/14 16:24:23

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        JspContextWrapper.java PageContextImpl.java
  Log:
  Changed findAttribute(name), removeAttribute(name),
  removeAttribute(name, scope), and getAttributesScope(name) to throw
  NPE if 'name' argument is null
  
  Revision  Changes    Path
  1.17      +27 -3     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java
  
  Index: JspContextWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JspContextWrapper.java    13 Feb 2003 23:26:42 -0000      1.16
  +++ JspContextWrapper.java    15 Feb 2003 00:24:22 -0000      1.17
  @@ -211,6 +211,12 @@
       }
   
       public Object findAttribute(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
           Object o = pageAttributes.get(name);
           if (o == null) {
            o = invokingJspCtxt.getAttribute(name, REQUEST_SCOPE);
  @@ -228,6 +234,12 @@
       }
   
       public void removeAttribute(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        pageAttributes.remove(name);
        invokingJspCtxt.removeAttribute(name, REQUEST_SCOPE);
        if (getSession() != null) {
  @@ -237,6 +249,12 @@
       }
   
       public void removeAttribute(String name, int scope) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        if (scope == PAGE_SCOPE){
            pageAttributes.remove(name);
        } else {
  @@ -245,6 +263,12 @@
       }
   
       public int getAttributesScope(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        if (pageAttributes.get(name) != null) {
            return PAGE_SCOPE;
        } else {
  
  
  
  1.44      +27 -3     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
  
  Index: PageContextImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PageContextImpl.java      13 Feb 2003 23:26:42 -0000      1.43
  +++ PageContextImpl.java      15 Feb 2003 00:24:22 -0000      1.44
  @@ -354,6 +354,12 @@
       }
   
       public void removeAttribute(String name, int scope) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        switch (scope) {
        case PAGE_SCOPE:
            attributes.remove(name);
  @@ -381,6 +387,12 @@
       }
   
       public int getAttributesScope(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        if (attributes.get(name) != null)
            return PAGE_SCOPE;
   
  @@ -399,6 +411,12 @@
       }
   
       public Object findAttribute(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
           Object o = attributes.get(name);
           if (o != null)
               return o;
  @@ -441,6 +459,12 @@
       }
   
       public void removeAttribute(String name) {
  +
  +     if (name == null) {
  +         throw new NullPointerException(
  +                 Localizer.getMessage("jsp.error.attribute.null_name"));
  +     }
  +
        try {
            removeAttribute(name, PAGE_SCOPE);
            removeAttribute(name, REQUEST_SCOPE);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to