Skip to content

Commit

Permalink
LDEV-4877 - fix regression in switching from multi to single
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 9, 2024
1 parent ed00142 commit 7f1f1a3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -1915,7 +1916,7 @@ public boolean isSingle() {

@Override
public Resource getWebConfigDir() {
return cs.getConfigDir();
return this.configDirWeb;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.0.3.0-SNAPSHOT"/>
<property name="version" value="6.0.3.1-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.0.3.0-SNAPSHOT</version>
<version>6.0.3.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 7f1f1a3

Please sign in to comment.