From 1b26370377da3bafc190585f6bc685274c548891 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 28 Apr 2006 13:58:01 +0000 Subject: [PATCH] * Set thread field in updatePrototypes() already so it is already set when the RequestEvaluator calls Application.getDataRoot(), which may result in a function invocation (chicken and egg problem, sort of) --- src/helma/scripting/rhino/RhinoEngine.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index 6257dc35..f70f88a5 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -145,6 +145,12 @@ public class RhinoEngine implements ScriptingEngine { * engine know it should update its prototype information. */ public void updatePrototypes() throws IOException { + // remember the current thread as our thread - we this here so + // the thread is already set when the RequestEvaluator calls + // Application.getDataRoot(), which may result in a function invocation + // (chicken and egg problem, kind of) + thread = Thread.currentThread(); + context = Context.enter(); context.setCompileFunctionsWithDynamicScope(true); context.setApplicationClassLoader(app.getClassLoader()); @@ -331,8 +337,9 @@ public class RhinoEngine implements ScriptingEngine { throw concur; } catch (Exception x) { // has the request timed out? If so, throw TimeoutException - if (thread != Thread.currentThread()) - throw new TimeoutException (); + if (thread != Thread.currentThread()) { + throw new TimeoutException(); + } // create and throw a ScriptingException with the right message String msg;