[PATCH] serialization implmentation inconsistent with serializable/non-serializable attributes

2002-01-13 Thread David Lecomber

Hi,

The writeObject method of StandardSession removes all the
non-null non-serializable attributes from the session.  This strikes me as
wrong, because a writing method shouldn't change the thing it writes..
Secondly if an attribute is null it's not persisted, nor is it added
to the attributes to unbind.  In StandardManger.unload() sessions are
expired after being serialized - which unbinds all the attributes..
Hence we don't need to do it in the first place..

Presently this is not a big issue because the writeObject is only
called from within a shutdown/reload anyway, but for future use I'd
like to suggest a patch.

David 

--- 
jakarta-tomcat-4.0.1-src/catalina/src/share/org/apache/catalina/session/StandardSession.java
Tue Nov 13 02:02:48 2001
+++ StandardSession.javaSun Jan 13 13:05:23 2002
@@ -1,5 +1,5 @@
 /*
- * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
 1.25 2001/07/31 02:00:02 craigmcc Exp $
+ * $Header: 
+/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
+ 1.25 2001/07/31 02:00:02 craigmcc Exp $
  * $Revision: 1.25 $
  * $Date: 2001/07/31 02:00:02 $
  *
@@ -1316,7 +1316,6 @@
 String keys[] = keys();
 ArrayList saveNames = new ArrayList();
 ArrayList saveValues = new ArrayList();
-ArrayList unbinds = new ArrayList();
 for (int i = 0; i < keys.length; i++) {
 Object value = null;
 synchronized (attributes) {
@@ -1327,8 +1326,7 @@
 else if (value instanceof Serializable) {
 saveNames.add(keys[i]);
 saveValues.add(value);
-} else
-unbinds.add(keys[i]);
+}
 }
 
 // Serialize the attribute count and the Serializable attributes
@@ -1348,16 +1346,9 @@
 if (debug >= 2)
 log("  storing attribute '" + saveNames.get(i) +
 "' with value NOT_SERIALIZED");
-unbinds.add(saveNames.get(i));
 }
 }
 
-// Unbind the non-Serializable attributes
-Iterator names = unbinds.iterator();
-while (names.hasNext()) {
-removeAttribute((String) names.next());
-}
-
 }
 
 

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




StandardManager : Session expiry thread.

2001-09-14 Thread David Lecomber

[tomcat 4.0-rc2] It's possible for the session expiring thread to not
catch an exception - thrown within session.expire - which then stops
this thread and means all other sessions are not expired (forever!)

at 
org.apache.catalina.session.StandardSession.removeAttribute(StandardSession.java:XX)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:XX)
at 
org.apache.catalina.session.StandardManager.processExpires(StandardManager.java:XX)
at org.apache.catalina.session.StandardManager.run(StandardManager.java:XX)
at java.lang.Thread.run(Thread.java:484)
 
I'd like to suggest an obvious patch to this -- a try/catch 
within/around removeAttribute or expire.  As it's day one of me
reading this mailing list, and even contemplating submitting a patch,
does anyone have opinions regarding the preferred fix?

Cheers
David