|
Attached is a patch (against the latest 5.5.x source) that addresses
this issue. -- Jess Holle Jess Holle wrote: It appears that the activate() and passivate() routines of StandardSession are not functioning properly. [I've only tested 5.0.30, but 5.5.x seem to have identical erroneous code.] |
--- StandardSession.java-1.49 2005-02-24 10:58:20.184415700 -0600
+++ StandardSession.java 2005-02-24 10:59:08.000000000 -0600
@@ -729,19 +729,20 @@
public void passivate() {
// Notify ActivationListeners
- HttpSessionEvent event = null;
- String keys[] = keys();
- for (int i = 0; i < keys.length; i++) {
- Object attribute = attributes.get(keys[i]);
- if (attribute instanceof HttpSessionActivationListener) {
- if (event == null)
- event = new HttpSessionEvent(getSession());
+ Context context = (Context) manager.getContainer();
+ Object listeners[] = context.getApplicationLifecycleListeners();
+ if (listeners != null) {
+ HttpSessionEvent event =
+ new HttpSessionEvent(getSession());
+ for (int i = 0; i < listeners.length; i++) {
+ if (!(listeners[i] instanceof HttpSessionActivationListener))
+ continue;
try {
- ((HttpSessionActivationListener)attribute)
+ ((HttpSessionActivationListener)listeners[i])
.sessionWillPassivate(event);
} catch (Throwable t) {
manager.getContainer().getLogger().error
- (sm.getString("standardSession.attributeEvent"), t);
+ (sm.getString("standardSession.sessionEvent"), t);
}
}
}
@@ -756,19 +757,20 @@
public void activate() {
// Notify ActivationListeners
- HttpSessionEvent event = null;
- String keys[] = keys();
- for (int i = 0; i < keys.length; i++) {
- Object attribute = attributes.get(keys[i]);
- if (attribute instanceof HttpSessionActivationListener) {
- if (event == null)
- event = new HttpSessionEvent(getSession());
+ Context context = (Context) manager.getContainer();
+ Object listeners[] = context.getApplicationLifecycleListeners();
+ if (listeners != null) {
+ HttpSessionEvent event =
+ new HttpSessionEvent(getSession());
+ for (int i = 0; i < listeners.length; i++) {
+ if (!(listeners[i] instanceof HttpSessionActivationListener))
+ continue;
try {
- ((HttpSessionActivationListener)attribute)
+ ((HttpSessionActivationListener)listeners[i])
.sessionDidActivate(event);
} catch (Throwable t) {
manager.getContainer().getLogger().error
- (sm.getString("standardSession.attributeEvent"), t);
+ (sm.getString("standardSession.sessionEvent"), t);
}
}
}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
