Hi

As state in the javadoc it should throw NullPointerException if name is null (wich make sense). But in the code they also throw an exception if the the value (o) is null!

Regards
/David


     setAttribute

public abstract void *setAttribute*(java.lang.String name,
                                 java.lang.Object o,
                                 int scope)

   register the name and object specified with appropriate scope semantics

   *Parameters:*
       |name| - the name of the attribute to set
       |o| - the object to associate with the name
|scope| - the scope with which to associate the name/object *Throws:* |java.lang.NullPointerException| - if the name or object is null |java.lang.IllegalArgumentException| - if the scope is invalid


*Throws:*
   |java.lang.NullPointerException| - if the name or object is null


4.1.31:
public void setAttribute(String name, Object o, int scope) {
      if (name == null) {
          throw new NullPointerException("name may not be null");
      }

      if (o == null) {
          throw new NullPointerException("object may not be null");
      }


Tim Funk wrote:

I am guesing it was a fix for spec compliance:

http://tomcat.apache.org/tomcat-4.1-doc/servletapi/javax/servlet/jsp/PageContext.html#setAttribute(java.lang.String,%20java.lang.Object,%20int)

-Tim

David Gagnon wrote:

Hi all,

I just installed a fresh tomcat 4.1.31 and run into this problem. From 4.1.30 to 4.1.31 the PageContexImpl.setAttribute has change in a way that make it unusable. I cannot set null attribute in the pageContext ?!?!?!

So the following call throw an exception in 4.1.31:
pageContext.setAttribute(LOOKUP_GROUP_DATA_KEY + enclosingGroup.getGroup(), null, PageContext.REQUEST_SCOPE);

Is that mean I need to check if an attribute is null before putting it into the pageContext.... It desn`t make sense to me?

This change make 4.1.31 totally unusable for me... Any idea on what I can do? Or where I'm wrong?

Thanks for your help!

/David



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



Reply via email to