diff --git a/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java b/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java index 3b016cb238..0d818b3491 100755 --- a/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java +++ b/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java @@ -993,24 +993,35 @@ public void invalidateUserScope(PageContextImpl pc, boolean migrateSessionData, ApplicationContext appContext = pc.getApplicationContext(); RefBoolean isNew = new RefBooleanImpl(); - // get in memory scopes - Map clientContext = getSubMap(cfClientContexts, appContext.getName()); - UserScope oldClient = (UserScope) clientContext.get(pc.getCFID()); - Map sessionContext = getSubMap(cfSessionContexts, appContext.getName()); - UserScope oldSession = (UserScope) sessionContext.get(pc.getCFID()); + boolean hasClientManagment = appContext.isSetClientManagement(); + boolean hasSessionManagment = appContext.isSetSessionManagement(); - ApplicationListener listener = factory.getConfig().getApplicationListener(); - try { - listener.onSessionEnd(factory, appContext.getName(), pc.getCFID()); + // get in memory scopes + UserScope oldClient = null; + if (hasClientManagment) { + Map clientContext = getSubMap(cfClientContexts, appContext.getName()); + oldClient = (UserScope) clientContext.get(pc.getCFID()); } - catch (Throwable t) { - ExceptionUtil.rethrowIfNecessary(t); - ExceptionHandler.log(pc.getConfig(), Caster.toPageException(t)); + UserScope oldSession = null; + if (hasSessionManagment) { + Map sessionContext = getSubMap(cfSessionContexts, appContext.getName()); + oldSession = (UserScope) sessionContext.get(pc.getCFID()); + } + + if (hasSessionManagment) { + ApplicationListener listener = factory.getConfig().getApplicationListener(); + try { + listener.onSessionEnd(factory, appContext.getName(), pc.getCFID()); + } + catch (Throwable t) { + ExceptionUtil.rethrowIfNecessary(t); + ExceptionHandler.log(pc.getConfig(), Caster.toPageException(t)); + } } // remove Scopes completly - removeCFSessionScope(pc); - removeClientScope(pc); + if (hasSessionManagment) removeCFSessionScope(pc); + if (hasClientManagment) removeClientScope(pc); pc.resetIdAndToken(); pc.resetSession(); diff --git a/loader/build.xml b/loader/build.xml index 6678e74dee..d5c2c317d1 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index ab06bc21a7..308b3d19dd 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.1.0.77-SNAPSHOT + 6.1.0.78-SNAPSHOT jar Lucee Loader Build