diff --git a/core/pom.xml b/core/pom.xml
index 66e957568e..e503fd54e3 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -129,7 +129,7 @@
org.apache.commons
commons-compress
- 1.23.0
+ 1.24.0
org.lucee
diff --git a/core/src/main/java/META-INF/MANIFEST.MF b/core/src/main/java/META-INF/MANIFEST.MF
index 600e3e4c8e..b7033fc0c0 100644
--- a/core/src/main/java/META-INF/MANIFEST.MF
+++ b/core/src/main/java/META-INF/MANIFEST.MF
@@ -318,7 +318,7 @@ Export-Package: coldfusion,
lucee.transformer.cfml.script.java.function
Require-Bundle: org.apache.commons.commons-codec;bundle-version=1.15.0,
org.apache.commons.commons-collections4;bundle-version=4.4.0,
- org.apache.commons.commons-compress;bundle-version=1.23.0,
+ org.apache.commons.commons-compress;bundle-version=1.24.0,
org.apache.commons.commons-fileupload;bundle-version=1.5.0,
org.apache.commons.commons-io;bundle-version=2.11.0,
org.apache.commons.lang3;bundle-version=3.12.0,
diff --git a/core/src/main/java/lucee/runtime/MappingImpl.java b/core/src/main/java/lucee/runtime/MappingImpl.java
index ed88664eb7..7a4fb28d9f 100755
--- a/core/src/main/java/lucee/runtime/MappingImpl.java
+++ b/core/src/main/java/lucee/runtime/MappingImpl.java
@@ -77,7 +77,6 @@ public final class MappingImpl implements Mapping {
private transient PCLCollection pcoll;
private Resource archive;
- private boolean hasArchive;
private final Config config;
private Resource classRootDirectory;
private final PageSourcePool pageSourcePool = new PageSourcePool();
@@ -136,8 +135,8 @@ public MappingImpl(Config config, String virtual, String strPhysical, String str
this.config = config;
this.hidden = hidden;
this.readonly = readonly;
- this.strPhysical = StringUtil.isEmpty(strPhysical) ? null : strPhysical;
- this.strArchive = StringUtil.isEmpty(strArchive) ? null : strArchive;
+ this.strPhysical = StringUtil.isEmpty(strPhysical, true) ? null : strPhysical.trim();
+ this.strArchive = StringUtil.isEmpty(strArchive, true) ? null : strArchive.trim();
this.inspect = inspect;
this.topLevel = topLevel;
this.appMapping = appMapping;
@@ -154,23 +153,24 @@ public MappingImpl(Config config, String virtual, String strPhysical, String str
else this.virtual = virtual;
this.lcVirtual = this.virtual.toLowerCase();
this.lcVirtualWithSlash = lcVirtual.endsWith("/") ? this.lcVirtual : this.lcVirtual + '/';
+ }
+ private void initPhysical() {
ServletContext cs = (config instanceof ConfigWeb) ? ((ConfigWeb) config).getServletContext() : null;
-
- // Physical
physical = ConfigWebUtil.getExistingResource(cs, strPhysical, null, config.getConfigDir(), FileUtil.TYPE_DIR, config, checkPhysicalFromWebroot);
- // Archive
+
+ if (archive == null) this.physicalFirst = true;
+ else if (physical == null) this.physicalFirst = false;
+
+ }
+
+ private void initArchive() {
+ ServletContext cs = (config instanceof ConfigWeb) ? ((ConfigWeb) config).getServletContext() : null;
archive = ConfigWebUtil.getExistingResource(cs, strArchive, null, config.getConfigDir(), FileUtil.TYPE_FILE, config, checkArchiveFromWebroot);
loadArchive();
- hasArchive = archive != null;
-
if (archive == null) this.physicalFirst = true;
else if (physical == null) this.physicalFirst = false;
- else this.physicalFirst = physicalFirst;
-
- // if(!hasArchive && !hasPhysical) throw new IOException("missing physical and archive path, one of
- // them must be defined");
}
private void loadArchive() {
@@ -179,7 +179,7 @@ private void loadArchive() {
CFMLEngine engine = ConfigWebUtil.getEngine(config);
BundleContext bc = engine.getBundleContext();
try {
- archiveBundle = OSGiUtil.installBundle(bc, archive, true);
+ archiveBundle = OSGiUtil.installBundle(bc, getArchive(), true);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
@@ -191,6 +191,7 @@ private void loadArchive() {
@Override
public Class> getArchiveClass(String className) throws ClassNotFoundException {
+ getArchive();// this calls init the archive if necessary
if (archiveBundle != null) {
return archiveBundle.loadClass(className);
}
@@ -200,6 +201,7 @@ public Class> getArchiveClass(String className) throws ClassNotFoundException
@Override
public Class> getArchiveClass(String className, Class> defaultValue) {
+ getArchive();// this calls init the archive if necessary
try {
if (archiveBundle != null) return archiveBundle.loadClass(className);
// else if(archiveClassLoader!=null) return archiveClassLoader.loadClass(className);
@@ -272,7 +274,6 @@ public Class> getPhysicalClass(String className, Class> defaultValue) {
@Override
public Class> getPhysicalClass(String className, byte[] code) throws IOException {
-
try {
return touchPhysicalClassLoader(className.contains("_cfc$cf")).loadClass(className, code);
}
@@ -304,6 +305,7 @@ public void resetPages(ClassLoader cl) {
@Override
public Resource getPhysical() {
+ if (physical == null && strPhysical != null) initPhysical(); // possible that the target path only exists AFTER startup
return physical;
}
@@ -319,18 +321,18 @@ public String getVirtualLowerCaseWithSlash() {
@Override
public Resource getArchive() {
- // initArchive();
+ if (archive == null && strArchive != null) initArchive(); // possible that the target path only exists AFTER startup
return archive;
}
@Override
public boolean hasArchive() {
- return hasArchive;
+ return getArchive() != null;
}
@Override
public boolean hasPhysical() {
- return physical != null;
+ return getPhysical() != null;
}
@Override
@@ -423,18 +425,13 @@ public void check() {
ServletContext cs = (config instanceof ConfigWeb) ? ((ConfigWeb) config).getServletContext() : null;
// Physical
- if (getPhysical() == null && strPhysical != null && strPhysical.length() > 0) {
- physical = ConfigWebUtil.getExistingResource(cs, strPhysical, null, config.getConfigDir(), FileUtil.TYPE_DIR, config, checkPhysicalFromWebroot);
+ if (getPhysical() == null && strPhysical != null) {
+ initPhysical();
}
// Archive
- if (getArchive() == null && strArchive != null && strArchive.length() > 0) {
-
- archive = ConfigWebUtil.getExistingResource(cs, strArchive, null, config.getConfigDir(), FileUtil.TYPE_FILE, config, checkArchiveFromWebroot);
- loadArchive();
-
- hasArchive = archive != null;
-
+ if (getArchive() == null && strArchive != null) {
+ initArchive();
}
}
@@ -450,6 +447,10 @@ public boolean isHidden() {
@Override
public boolean isPhysicalFirst() {
+ // make sure everything is loaded
+ getArchive();
+ getPhysical();
+ // now we can trust the result
return physicalFirst;
}
diff --git a/loader/pom.xml b/loader/pom.xml
index aed94cb022..afc017f672 100644
--- a/loader/pom.xml
+++ b/loader/pom.xml
@@ -371,7 +371,7 @@
org.apache.commons
commons-compress
- 1.23.0
+ 1.24.0
org.lucee