Skip to content

Commit

Permalink
add some static/temporary logging to see what is going on
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 17, 2024
1 parent 975d192 commit 980f08c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ public final class ThreadLocalPageContext {
*/
public static void register(PageContext pc) {// print.ds(Thread.currentThread().getName());
if (pc == null) {
print.e(Thread.currentThread() + " register: null");
print.e(Thread.currentThread().getName() + " register: null");
return; // TODO happens with Gateway, but should not!
}
print.e(Thread.currentThread() + " do register: " + pc.getId());
print.e(Thread.currentThread().getName() + " do register: " + pc.getId());
// TODO should i set the old one by "release"?
Thread t = Thread.currentThread();
t.setContextClassLoader(((ConfigPro) pc.getConfig()).getClassLoaderEnv());
((PageContextImpl) pc).setThread(t);
pcThreadLocal.set(pc);
pcThreadLocalInheritable.set(pc);
print.e(Thread.currentThread() + " registered: " + pc.getId());
print.e(Thread.currentThread().getName() + " registered: " + pc.getId());
}

public static PageContext get() {
Expand Down Expand Up @@ -112,11 +112,11 @@ public static Config getConfig() {
*/
public static void release() {
PageContext dodelete = get();
if (dodelete != null) print.e(Thread.currentThread() + " do release: " + dodelete.getId());
else print.e(Thread.currentThread() + " do release: null");
if (dodelete != null) print.e(Thread.currentThread().getName() + " do release: " + dodelete.getId());
else print.e(Thread.currentThread().getName() + " do release: null");
pcThreadLocal.set(null);
pcThreadLocalInheritable.set(null);
print.e(Thread.currentThread() + " released");
print.e(Thread.currentThread().getName() + " released");
}

public static Config getConfig(PageContext pc) {
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/lucee/runtime/type/EnvUDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;

import lucee.print;
import lucee.runtime.Component;
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
Expand All @@ -48,6 +49,10 @@ public EnvUDF() {// needed for externalize
EnvUDF(UDFProperties properties) {
super(properties);
PageContext pc = ThreadLocalPageContext.get();
if (pc == null) {
print.e(Thread.currentThread().getName() + " EnvUDF");
System.exit(0);
}
if (pc.undefinedScope().getCheckArguments()) {
this.variables = new ClosureScope(pc, pc.argumentsScope(), pc.localScope(), pc.variablesScope());
}
Expand Down

0 comments on commit 980f08c

Please sign in to comment.