--- java/org/apache/catalina/session/StandardSession.java (revision 1594906) +++ java/org/apache/catalina/session/StandardSession.java (working copy) @@ -822,51 +822,50 @@ } } } - } finally { - if (oldTccl != null) { - if (Globals.IS_SECURITY_ENABLED) { - PrivilegedAction pa = - new PrivilegedSetTccl(oldTccl); - AccessController.doPrivileged(pa); - } else { - Thread.currentThread().setContextClassLoader(oldTccl); - } - } - } - if (ACTIVITY_CHECK) { - accessCount.set(0); - } - - // Remove this session from our manager's active sessions - manager.remove(this, true); - - // Notify interested session event listeners - if (notify) { - fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null); - } - - // Call the logout method - if (principal instanceof GenericPrincipal) { - GenericPrincipal gp = (GenericPrincipal) principal; - try { - gp.logout(); - } catch (Exception e) { - manager.getContainer().getLogger().error( - sm.getString("standardSession.logoutfail"), - e); + if (ACTIVITY_CHECK) { + accessCount.set(0); } - } - // We have completed expire of this session - setValid(false); - expiring = false; - - // Unbind any objects associated with this session - String keys[] = keys(); - for (int i = 0; i < keys.length; i++) - removeAttributeInternal(keys[i], notify); - + // Remove this session from our manager's active sessions + manager.remove(this, true); + + // Notify interested session event listeners + if (notify) { + fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null); + } + + // Call the logout method + if (principal instanceof GenericPrincipal) { + GenericPrincipal gp = (GenericPrincipal) principal; + try { + gp.logout(); + } catch (Exception e) { + manager.getContainer().getLogger().error( + sm.getString("standardSession.logoutfail"), + e); + } + } + + // We have completed expire of this session + setValid(false); + expiring = false; + + // Unbind any objects associated with this session + String keys[] = keys(); + for (int i = 0; i < keys.length; i++) + removeAttributeInternal(keys[i], notify); + } finally { + if (oldTccl != null) { + if (Globals.IS_SECURITY_ENABLED) { + PrivilegedAction pa = + new PrivilegedSetTccl(oldTccl); + AccessController.doPrivileged(pa); + } else { + Thread.currentThread().setContextClassLoader(oldTccl); + } + } + } } }