From 7f1f1a3b973b4f2ba6521ddb60a9ce7ee6526047 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Sun, 9 Jun 2024 15:59:58 +0200 Subject: [PATCH] LDEV-4877 - fix regression in switching from multi to single --- .../main/java/lucee/runtime/config/ConfigWebFactory.java | 6 +++--- .../java/lucee/runtime/config/SingleContextConfigWeb.java | 7 ++++--- .../src/main/java/lucee/runtime/engine/CFMLEngineImpl.java | 4 ++-- loader/build.xml | 2 +- loader/pom.xml | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java index d53a9d534d..791433f9f6 100644 --- a/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java +++ b/core/src/main/java/lucee/runtime/config/ConfigWebFactory.java @@ -320,7 +320,7 @@ public static ConfigWebPro newInstanceMulti(CFMLEngine engine, CFMLFactoryImpl f return configWeb; } - public static ConfigWebPro newInstanceSingle(CFMLEngine engine, CFMLFactoryImpl factory, ConfigServerImpl configServer, ServletConfig servletConfig, + public static ConfigWebPro newInstanceSingle(CFMLEngine engine, CFMLFactoryImpl factory, ConfigServerImpl configServer, Resource configDirWeb, ServletConfig servletConfig, ConfigWebImpl existingToUpdate) throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, NoSuchAlgorithmException, BundleException, ConverterException { @@ -335,7 +335,7 @@ public static ConfigWebPro newInstanceSingle(CFMLEngine engine, CFMLFactoryImpl ); boolean doNew = configServer.getUpdateInfo().updateType != NEW_NONE; - SingleContextConfigWeb sccw = new SingleContextConfigWeb(factory, configServer, servletConfig); + SingleContextConfigWeb sccw = new SingleContextConfigWeb(factory, configServer, servletConfig, configDirWeb); ConfigWebPro configWeb = existingToUpdate != null ? existingToUpdate.setInstance(sccw) : new ConfigWebImpl(sccw); factory.setConfig(configServer, configWeb); @@ -421,7 +421,7 @@ public static void reloadInstance(CFMLEngine engine, ConfigServerImpl cs, Config // changed from multi to single if (isSingle != isWebSingle) { try { - newInstanceSingle(engine, (CFMLFactoryImpl) cwi.getFactory(), cs, cwi.getServletConfig(), cwi); + newInstanceSingle(engine, (CFMLFactoryImpl) cwi.getFactory(), cs, cwi.getWebConfigDir(), cwi.getServletConfig(), cwi); return; } catch (NoSuchAlgorithmException e) { diff --git a/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java b/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java index ee0a67ee22..b2e7546c7d 100644 --- a/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java +++ b/core/src/main/java/lucee/runtime/config/SingleContextConfigWeb.java @@ -118,12 +118,13 @@ class SingleContextConfigWeb extends ConfigBase implements ConfigWebInner { private Resource rootDir; private Mapping[] mappings; private lucee.runtime.rest.Mapping[] restMappings; + private Resource configDirWeb; - public SingleContextConfigWeb(CFMLFactoryImpl factory, ConfigServerImpl cs, ServletConfig config) { + public SingleContextConfigWeb(CFMLFactoryImpl factory, ConfigServerImpl cs, ServletConfig config, Resource configDirWeb) { this.factory = factory; this.cs = cs; this.config = config; - + this.configDirWeb = configDirWeb; ResourceProvider frp = ResourcesImpl.getFileResourceProvider(); this.rootDir = frp.getResource(ReqRspUtil.getRootPath(config.getServletContext())); @@ -1915,7 +1916,7 @@ public boolean isSingle() { @Override public Resource getWebConfigDir() { - return cs.getConfigDir(); + return this.configDirWeb; } @Override diff --git a/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java b/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java index c8de710d9c..b46298386d 100644 --- a/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java +++ b/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java @@ -974,12 +974,12 @@ private CFMLFactoryImpl loadJSPFactory(ConfigServerImpl configServer, ServletCon boolean multi = configServer.getAdminMode() == ConfigImpl.ADMINMODE_MULTI; ConfigWebPro config; RefBoolean isCustomSetting = new RefBooleanImpl(); + Resource configDir = getConfigDirectory(sg, configServer, countExistingContextes, isCustomSetting); if (multi) { - Resource configDir = getConfigDirectory(sg, configServer, countExistingContextes, isCustomSetting); config = ConfigWebFactory.newInstanceMulti(this, factory, configServer, configDir, sg, null); } else { - config = ConfigWebFactory.newInstanceSingle(this, factory, configServer, sg, null); + config = ConfigWebFactory.newInstanceSingle(this, factory, configServer, configDir, sg, null); } if (ConfigWebFactory.LOG) LogUtil.log(configServer, Log.LEVEL_INFO, "startup", "Loaded config"); diff --git a/loader/build.xml b/loader/build.xml index 78447fb6bf..f93764aa4a 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index 13d03f217e..8ff98059c4 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.0.3.0-SNAPSHOT + 6.0.3.1-SNAPSHOT jar Lucee Loader Build