From ee211c072a0284f0c50ea77a5352565263aea82b Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 6 Dec 2024 16:41:51 +0100 Subject: [PATCH] test invalid access (same PS at the same time) --- .../java/lucee/runtime/PageSourceImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/lucee/runtime/PageSourceImpl.java b/core/src/main/java/lucee/runtime/PageSourceImpl.java index f387ab5a77..a21e6ce77f 100755 --- a/core/src/main/java/lucee/runtime/PageSourceImpl.java +++ b/core/src/main/java/lucee/runtime/PageSourceImpl.java @@ -24,7 +24,10 @@ import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import lucee.print; import lucee.commons.io.IOUtil; import lucee.commons.io.log.Log; import lucee.commons.io.log.LogUtil; @@ -459,7 +462,16 @@ private boolean isLoad(byte load) { return page != null && load == page.getLoadType(); } - private synchronized Page compile(ConfigWeb config, Resource classRootDir, Page existing, boolean returnValue, boolean ignoreScopes) throws TemplateException { + private static Map datas = new ConcurrentHashMap<>(); + + private Page compile(ConfigWeb config, Resource classRootDir, Page existing, boolean returnValue, boolean ignoreScopes) throws TemplateException { + print.e("->" + getDisplayPath()); + String st = datas.get(getDisplayPath()); + if (st != null) { + print.e("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"); + print.ds(st); + } + datas.put(getDisplayPath(), ExceptionUtil.getStacktrace(new Throwable(), false)); try { return _compile(config, classRootDir, existing, returnValue, ignoreScopes, false); } @@ -486,6 +498,10 @@ private synchronized Page compile(ConfigWeb config, Resource classRootDir, Page if (t instanceof TemplateException) throw (TemplateException) t; throw new PageRuntimeException(Caster.toPageException(t)); } + finally { + datas.remove(getDisplayPath()); + print.e("<-" + getDisplayPath()); + } } private Page _compile(ConfigWeb config, Resource classRootDir, Page existing, boolean returnValue, boolean ignoreScopes, boolean split)