You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by me...@redspark.com on 2001/07/10 06:24:08 UTC

setAttribute

 
I am looking at setAttribute implementation of Standard Session. Tomcat seems to be differing from what spec says. Is this intentional?
 
 
As per spec:
 
    Both name and value of setAttribute should be not null. I assumed when either of parameters is null servlet container throws IllegalArguementException.
    But tomcat allows setAttribute(null, null);
 
    If session.setAttribute("someKey", null) is used tomcat removes previous object in session with key "someKey".
 
    More interesting example:
 
        session.setAttribute(null, "KeyValueisNotNULL");
        (String)session.getAttribute(null)    returns "KeyValueisNotNULL"
 
 
I believe this is a wrong behaviour.
Any comments?
 
 
 
Kumar.