DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12363>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12363 StandardSession.setAttribute() does not conform to the servlet spec Summary: StandardSession.setAttribute() does not conform to the servlet spec Product: Tomcat 4 Version: 4.0.4 Final Platform: Other OS/Version: Other Status: NEW Severity: Blocker Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I found a little problem in the method setAttribute() of StandardSesssion.java. Acording to section SVR.7.4 of the servlet spec: "The valueBound method must be called before the object is made available via the getAttribute method of the HttpSession interface. The valueUbound method must be called after the object is no longer available via the getAttribute method of the HttpSession interface.". The problem in the setAttribute() code is that valueBound() is called after the value is put into the attributes of the session. Here is the code with the problem: .... // Replace or add this attribute Object unbound = null; synchronized (attributes) { unbound = attributes.get(name); attributes.put(name, value); } // Call the valueUnbound() method if necessary if ((unbound != null) && (unbound instanceof HttpSessionBindingListener)) { ((HttpSessionBindingListener) unbound).valueUnbound (new HttpSessionBindingEvent((HttpSession) this, name)); } // Call the valueBound() method if necessary HttpSessionBindingEvent event = null; if (unbound != null) event = new HttpSessionBindingEvent ((HttpSession) this, name, unbound); else event = new HttpSessionBindingEvent ((HttpSession) this, name, value); if (value instanceof HttpSessionBindingListener) ((HttpSessionBindingListener) value).valueBound(event); ... Here is the corrected code: .... // Construct an event with the new value HttpSessionBindingEvent event = new HttpSessionBindingEvent ((HttpSession) this, name, value); // Call the valueBound() method if necessary if (value instanceof HttpSessionBindingListener) ((HttpSessionBindingListener) value).valueBound(event); // Replace or add this attribute Object unbound = null; synchronized (attributes) { unbound = attributes.get(name); attributes.put(name, value); } // Call the valueUnbound() method if necessary if ((unbound != null) && (unbound instanceof HttpSessionBindingListener)) { ((HttpSessionBindingListener) unbound).valueUnbound (new HttpSessionBindingEvent((HttpSession) this, name)); } // Replace the current event with one containing // the old value if necesary if (unbound != null) event = new HttpSessionBindingEvent ((HttpSession) this, name, unbound); ... -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>