luehe       2002/09/30 16:45:03

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        PageContextImpl.java
  Log:
  Fixed Bugzilla 13138 ("Compliance issue.
  PageContext.setAttribute(String, Object, int) fails to throw an
  IllegalArgumentException if provide an invalid scope.")
  
  Revision  Changes    Path
  1.22      +21 -16    
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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- PageContextImpl.java      30 Sep 2002 23:30:35 -0000      1.21
  +++ PageContextImpl.java      30 Sep 2002 23:45:03 -0000      1.22
  @@ -246,7 +246,8 @@
   
            case SESSION_SCOPE:
                if (session == null)
  -                 throw new IllegalArgumentException("can't access SESSION_SCOPE 
without an HttpSession");
  +                 throw new IllegalArgumentException(
  +                        "can't access SESSION_SCOPE without an HttpSession");
                else
                    return session.getAttribute(name);
   
  @@ -254,7 +255,7 @@
                return context.getAttribute(name);
   
            default:
  -             throw new IllegalArgumentException("unidentified scope");
  +             throw new IllegalArgumentException("Invalid scope");
        }
       }
   
  @@ -268,24 +269,26 @@
        switch (scope) {
            case PAGE_SCOPE:
                attributes.put(name, o);
  -         break;
  +             break;
   
            case REQUEST_SCOPE:
                request.setAttribute(name, o);
  -         break;
  +             break;
   
            case SESSION_SCOPE:
                if (session == null)
  -                 throw new IllegalArgumentException("can't access SESSION_SCOPE 
without an HttpSession");
  +                 throw new IllegalArgumentException(
  +                        "can't access SESSION_SCOPE without an HttpSession");
                else
                    session.setAttribute(name, o);
  -         break;
  +             break;
   
            case APPLICATION_SCOPE:
                context.setAttribute(name, o);
  -         break;
  +             break;
   
            default:
  +             throw new IllegalArgumentException("Invalid scope");
        }
       }
   
  @@ -293,25 +296,26 @@
        switch (scope) {
            case PAGE_SCOPE:
                attributes.remove(name);
  -         break;
  +             break;
   
            case REQUEST_SCOPE:
                request.removeAttribute(name);
  -            break;
  +             break;
   
            case SESSION_SCOPE:
                if (session == null)
  -                 throw new IllegalArgumentException("can't access SESSION_SCOPE 
without an HttpSession");
  +                 throw new IllegalArgumentException(
  +                        "can't access SESSION_SCOPE without an HttpSession");
                else
                       session.removeAttribute(name);
                   // was:
                   //               session.removeValue(name);
                   // REVISIT Verify this is correct - akv
  -         break;
  +             break;
   
            case APPLICATION_SCOPE:
                context.removeAttribute(name);
  -         break;
  +             break;
   
            default:
        }
  @@ -364,7 +368,8 @@
                if (session != null) {
                    return session.getAttributeNames();
                } else
  -                 throw new IllegalArgumentException("can't access SESSION_SCOPE 
without an HttpSession");
  +                 throw new IllegalArgumentException(
  +                        "can't access SESSION_SCOPE without an HttpSession");
   
            case APPLICATION_SCOPE:
                return context.getAttributeNames();
  
  
  

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

Reply via email to