luehe       2002/11/08 11:11:26

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        PageContextImpl.java
  Log:
  Made enumeration of ValidationMessage[] returned by TLV's validate()
  method more robust by also considering the case where a
  ValidationMessage element might be null.
  
  Revision  Changes    Path
  1.35      +20 -9     
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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- PageContextImpl.java      7 Nov 2002 23:33:38 -0000       1.34
  +++ PageContextImpl.java      8 Nov 2002 19:11:26 -0000       1.35
  @@ -274,19 +274,26 @@
   
       public void setAttribute(String name, Object attribute) {
   
  -     if (name == null || attribute == null)
  -         throw new NullPointerException("Null name or attribute value");
  -
  -     attributes.put(name, attribute);
  +     if (name == null) {
  +         throw new NullPointerException("Null name");
  +     }
  +
  +     if (attribute != null) {
  +         attributes.put(name, attribute);
  +     } else {
  +         removeAttribute(name, PAGE_SCOPE);
  +     }
       }
   
   
       public void setAttribute(String name, Object o, int scope) {
   
  -     if (name == null || o == null)
  -         throw new NullPointerException("Null name or attribute value");
  +     if (name == null) {
  +         throw new NullPointerException("Null name");
  +     }
   
  -     switch (scope) {
  +     if (o != null) {
  +         switch (scope) {
            case PAGE_SCOPE:
                attributes.put(name, o);
                break;
  @@ -309,6 +316,10 @@
   
            default:
                throw new IllegalArgumentException("Invalid scope");
  +         } // switch
  +
  +     } else {
  +         removeAttribute(name, scope);
        }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>

Reply via email to