[EMAIL PROTECTED] wrote:
billbarker 2002/12/30 19:45:48Seems to me that all but the last setID(sessionID) in the code above should be removed. The session ID should not be set until a unique id has been found. I have attached a patch against the current head removing the lines to be deleted. Unless I am missing something, there is no point in making these calls -- and from looking at what setID does, there could be some undesirable side effects.
Modified: catalina/src/share/org/apache/catalina/session
ManagerBase.java
Log:
Make certain that the jvmRoute is attached to the session before comparing for uniqueness.
Submitted by: Glenn Olander [EMAIL PROTECTED]
Revision Changes Path
1.16 +15 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java
Index: ManagerBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ManagerBase.java 30 Dec 2002 02:36:26 -0000 1.15
+++ ManagerBase.java 31 Dec 2002 03:45:48 -0000 1.16
@@ -580,17 +580,23 @@
session.setMaxInactiveInterval(this.maxInactiveInterval);
String sessionId = generateSessionId();
- synchronized (sessions) {
- while (sessions.get(sessionId) != null) // Guarantee uniqueness
- sessionId = generateSessionId();
- }
-
String jvmRoute = getJvmRoute();
// @todo Move appending of jvmRoute generateSessionId()???
if (jvmRoute != null) {
sessionId += '.' + jvmRoute;
session.setId(sessionId);
}
+ synchronized (sessions) {
+ while (sessions.get(sessionId) != null){ // Guarantee uniqueness
+ sessionId = generateSessionId();
+ // @todo Move appending of jvmRoute generateSessionId()???
+ if (jvmRoute != null) {
+ sessionId += '.' + jvmRoute;
+ session.setId(sessionId);
+ }
+ }
+ }
+
session.setId(sessionId);
return (session);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-Phil
Index: ManagerBase.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v retrieving revision 1.16 diff -u -r1.16 ManagerBase.java --- ManagerBase.java 31 Dec 2002 03:45:48 -0000 1.16 +++ ManagerBase.java 1 Jan 2003 00:37:30 -0000 @@ -584,7 +584,6 @@ // @todo Move appending of jvmRoute generateSessionId()??? if (jvmRoute != null) { sessionId += '.' + jvmRoute; - session.setId(sessionId); } synchronized (sessions) { while (sessions.get(sessionId) != null){ // Guarantee uniqueness @@ -592,7 +591,6 @@ // @todo Move appending of jvmRoute generateSessionId()??? if (jvmRoute != null) { sessionId += '.' + jvmRoute; - session.setId(sessionId); } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>