Skip to content

Commit

Permalink
Merge branch '6.2' into 7.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
#	core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
#	loader/build.xml
#	loader/pom.xml
#	loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java
#	loader/src/main/java/lucee/loader/util/Util.java
#	loader/src/main/java/lucee/loader/util/log/Logging.java
  • Loading branch information
michaeloffner committed Dec 20, 2024
2 parents cba27b2 + 6d4fc6d commit ad4ebf2
Show file tree
Hide file tree
Showing 76 changed files with 1,159 additions and 713 deletions.
2 changes: 2 additions & 0 deletions ant/build-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@
<jvmarg value="-XX:+UnlockExperimentalVMOptions" if:true="${UseEpsilonGC}"/>
<jvmarg value="-XX:+UseEpsilonGC" if:true="${UseEpsilonGC}"/>
<jvmarg value="-XX:+AlwaysPreTouch" if:true="${UseEpsilonGC}"/>
<jvmarg value="-XX:StartFlightRecording=disk=true,dumponexit=true,filename=${temp}/../lucee-testcases.jfr,maxsize=1024m,maxage=1d,settings=profile,path-to-gc-roots=true" if:true="${FlightRecording}"/>
<jvmarg value="-XX:FlightRecorderOptions=stackdepth=128" if:true="${FlightRecording}"/>
<!--
<jvmarg value="-XX:StartFlightRecording=disk=true,dumponexit=true,filename=${temp}/../lucee-testcases.jfr,maxsize=1024m,maxage=1d,settings=profile,path-to-gc-roots=true"/>
<jvmarg value="-Dlucee.system.out=file:.../out.txt"/>
Expand Down
6 changes: 5 additions & 1 deletion core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/Lucee loader"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions core/src/main/java/lucee/commons/digest/Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import lucee.commons.io.CharsetUtil;
import lucee.commons.io.IOUtil;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;

public class Hash {
Expand Down Expand Up @@ -189,6 +190,7 @@ public static String hash(String str, String algorithm, int numIterations, char[
return str;
}
catch (CloneNotSupportedException e) {
LogUtil.warn("hash", e);
}

// if not possible to clone the MessageDigest create always a new instance
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/lucee/commons/io/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;

import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.util.ResourceUtil;
import lucee.loader.util.Util;
Expand Down Expand Up @@ -171,6 +172,7 @@ public static boolean isLocked(Resource res) {
return true;
}
catch (Exception e) {
LogUtil.warn("file", e);
}

return false;
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/lucee/commons/io/SystemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import lucee.commons.collection.AccessOrderLimitedSizeMap;
import lucee.commons.digest.MD5;
import lucee.commons.io.log.Log;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourceProvider;
import lucee.commons.io.res.ResourcesImpl;
Expand Down Expand Up @@ -514,6 +515,7 @@ public static Resource getRuningContextRoot() {
return frp.getResource(".").getCanonicalResource();
}
catch (IOException e) {
LogUtil.warn("system", e);
}
URL url = InfoImpl.class.getClassLoader().getResource(".");
try {
Expand Down Expand Up @@ -654,6 +656,7 @@ private static String addPlaceHolder(Resource dir, Resource file, String placeho
return StringUtil.replace(file.getCanonicalPath(), dir.getCanonicalPath(), placeholder, true);
}
catch (IOException e) {
LogUtil.warn("system", e);
}
}
return null;
Expand Down Expand Up @@ -726,6 +729,7 @@ public static String hash(ServletContext sc) {
id = MD5.getDigestAsString(ReqRspUtil.getRootPath(sc));
}
catch (IOException e) {
LogUtil.warn("system", e);
}
return id;
}
Expand Down Expand Up @@ -1096,6 +1100,7 @@ public static TemplateLine getCurrentContext(PageContext pc) {
if (pc != null) template = ExpandPath.call(pc, template);
}
catch (PageException e) {
LogUtil.warn("system", e);
} // optional step, so in case it fails we are still fine

return new TemplateLine(template, line);
Expand Down Expand Up @@ -1792,6 +1797,7 @@ public static boolean isBooted() {
return Caster.toBoolean(Reflector.callStaticMethod(clazz, "isBooted", EMPTY_OBJ)).booleanValue();
}
catch (Exception e) {
LogUtil.warn("system", e);
}
}
return true;
Expand Down Expand Up @@ -1824,6 +1830,7 @@ public static boolean getJavaObjectInputStreamAccessCheckArray(ObjectInputStream
joisa = Reflector.callStaticMethod(clazz, "getJavaObjectInputStreamAccess", EMPTY_OBJ);
}
catch (Exception e) {
LogUtil.warn("system", e);
}
}

Expand All @@ -1834,6 +1841,7 @@ public static boolean getJavaObjectInputStreamAccessCheckArray(ObjectInputStream
return true;
}
catch (Exception e) {
LogUtil.warn("system", e);
}
}
return false;
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/lucee/commons/io/TemporaryStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.InputStream;
import java.io.OutputStream;

import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.util.ResourceUtil;
import lucee.commons.lang.SerializableObject;
Expand Down Expand Up @@ -197,6 +198,7 @@ public static Resource getTempDirectory() {
tempFile = getCanonicalResourceEL(tempFile);
}
catch (IOException ioe) {
LogUtil.warn("temporary-stream", ioe);
}
finally {
if (tmp != null) tmp.delete();
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/lucee/commons/io/compress/ZipUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.zip.ZipOutputStream;

import lucee.commons.cli.Command;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.runtime.type.util.ListUtil;

Expand All @@ -37,6 +38,7 @@ public static void unzip(Resource zip, Resource dir) throws IOException {
Command.execute("unzip", new String[] { "-o", zip.getAbsolutePath(), "-d", dir.getAbsolutePath() });
}
catch (InterruptedException e) {
LogUtil.warn("zip", e);
}
return;
}
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/lucee/commons/io/log/LogUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public static void log(Config config, int level, String type, String msg) {
log(config, level, "application", type, msg);
}

public static void warn(String type, Throwable t) {
log((Config) null, type, t, Log.LEVEL_WARN, "application");
}

//////////
public static void log(String type, Throwable t) {
log((Config) null, type, t, Log.LEVEL_ERROR, "application");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ private static Object[] getCorrelationIdentifier() {

// CorrelationIdentifier.getTraceId()
if (getTraceId == null) {
getTraceId = Reflector.getMethod(correlationIdentifierClass, "getTraceId", EMPTY_CLASS);
getTraceId = Reflector.getMethod(correlationIdentifierClass, "getTraceId", EMPTY_CLASS, true);
}

// CorrelationIdentifier.getSpanId()
if (getSpanId == null) {
getSpanId = Reflector.getMethod(correlationIdentifierClass, "getSpanId", EMPTY_CLASS);
getSpanId = Reflector.getMethod(correlationIdentifierClass, "getSpanId", EMPTY_CLASS, true);
}
Object[] tmp = new Object[] { getTraceId.invoke(null, EMPTY_OBJ), getSpanId.invoke(null, EMPTY_OBJ) };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private void load(boolean caseSensitivex) {
ffile.createFile(false);
}
catch (IOException e) {
LogUtil.warn("compress", e);
}
}
// remove all the old extracts
Expand Down Expand Up @@ -200,6 +201,7 @@ private void doSynchronize() {
// ramProvider=null;
}
catch (IOException e) {
LogUtil.warn("compress", e);
}
}

Expand Down Expand Up @@ -229,7 +231,7 @@ private void runTGZ(Resource res) {
gos = new GZIPOutputStream(res.getOutputStream());
// wait for sync
while (true) {
sleepEL();
SystemUtil.sleep(interval);
if (zip.syn + interval <= System.currentTimeMillis()) break;
}
// sync
Expand All @@ -238,6 +240,7 @@ private void runTGZ(Resource res) {
CompressUtil.compressGZip(tmpis, gos);
}
catch (IOException e) {
LogUtil.warn("compress", e);
}
finally {
IOUtil.closeEL(gos);
Expand All @@ -254,13 +257,14 @@ private void runTar(Resource res) {
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
// wait for sync
while (true) {
sleepEL();
SystemUtil.sleep(interval);
if (zip.syn + interval <= System.currentTimeMillis()) break;
}
// sync
CompressUtil.compressTar(root.listResources(), tos, -1);
}
catch (IOException e) {
LogUtil.warn("compress", e);
}
finally {
IOUtil.closeEL(tos);
Expand All @@ -274,28 +278,21 @@ private void runZip(Resource res) {
zos = new ZipOutputStream(res.getOutputStream());
// wait for sync
while (true) {
sleepEL();
SystemUtil.sleep(interval);
if (zip.syn + interval <= System.currentTimeMillis()) break;
}
// sync
CompressUtil.compressZip(root.listResources(), zos, null);
}
catch (IOException e) {
LogUtil.warn("compress", e);
}
finally {
IOUtil.closeEL(zos);
running = false;
}
}

private void sleepEL() {
try {
sleep(interval);
}
catch (InterruptedException e) {
}
}

public boolean isRunning() {
return running;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.concurrent.ConcurrentHashMap;

import lucee.commons.db.DBUtil;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourceProvider;
import lucee.commons.io.res.ResourceProviderPro;
Expand Down Expand Up @@ -557,6 +558,7 @@ void release(DatasourceConnection dc) {
DBUtil.setTransactionIsolationEL(dc.getConnection(), ((DatasourceConnectionPro) dc).getDefaultTransactionIsolation());
}
catch (SQLException e) {
LogUtil.warn("datasource-resource-provider", e);
}
getManager().releaseConnection(ThreadLocalPageContext.get(), dc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import lucee.commons.io.IOUtil;
import lucee.commons.io.ModeUtil;
import lucee.commons.io.SystemUtil;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.ContentType;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourceProvider;
Expand Down Expand Up @@ -88,7 +89,8 @@ public void copyFrom(Resource res, boolean append) throws IOException {
Files.copy(((File) res).toPath(), this.toPath(), COPY_OPTIONS);
return;
}
catch (Exception exception) {
catch (Exception e) {
LogUtil.warn("file-resource-provider", e);
}
}

Expand All @@ -112,7 +114,8 @@ public void copyTo(Resource res, boolean append) throws IOException {
Files.copy(this.toPath(), ((File) res).toPath(), COPY_OPTIONS);
return;
}
catch (Exception exception) {
catch (Exception e) {
LogUtil.warn("file-resource-provider", e);
}
}

Expand All @@ -137,6 +140,21 @@ public Resource getCanonicalResource() throws IOException {
return new FileResource(provider, getCanonicalPath());
}

public String getCanonicalPath() {
try {
// java 12 performance regression LDEV-5218
if (SystemUtil.JAVA_VERSION > SystemUtil.JAVA_VERSION_11 )
return Path.of(getPath()).toAbsolutePath().normalize().toString();
return super.getCanonicalPath();
}
catch (IOException e) {
return getAbsolutePath();
}
catch (java.nio.file.InvalidPathException ipe) {
return getPath();
}
}

@Override
public Resource getParentResource() {
String p = getParent();
Expand Down Expand Up @@ -270,6 +288,7 @@ public OutputStream getOutputStream(boolean append) throws IOException {
}
// ignore this
catch (FileAlreadyExistsException faee) {
LogUtil.warn("file-resource-provider", faee);
}
catch (IOException ioe) {
Resource p = getParentResource();
Expand Down Expand Up @@ -420,6 +439,7 @@ public int getMode() {

}
catch (Exception e) {
LogUtil.warn("file-resource-provider", e);
}

}
Expand All @@ -443,6 +463,7 @@ public static int getMode(Path path) {

}
catch (Exception e) {
LogUtil.warn("file-resource-provider", e);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import lucee.commons.date.JREDateTimeUtil;
import lucee.commons.io.IOUtil;
import lucee.commons.io.ModeUtil;
import lucee.commons.io.log.LogUtil;
import lucee.commons.io.res.Resource;
import lucee.commons.io.res.ResourceProvider;
import lucee.commons.io.res.util.ResourceSupport;
Expand Down Expand Up @@ -387,6 +388,7 @@ public boolean setLastModified(long time) {
return true;
}
catch (IOException e) {
LogUtil.warn("ftp", e);
}
finally {
provider.returnClient(client);
Expand Down Expand Up @@ -580,6 +582,7 @@ public int getMode() {

}
catch (IOException e) {
LogUtil.warn("ftp", e);
}
finally {
provider.returnClient(client);
Expand Down Expand Up @@ -618,6 +621,7 @@ public void setMode(int mode) throws IOException {
}
}
catch (IOException e) {
LogUtil.warn("ftp", e);
}
finally {
provider.returnClient(client);
Expand Down
Loading

0 comments on commit ad4ebf2

Please sign in to comment.