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.

Reply via email to