Return-Path: Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 82105 invoked by uid 500); 20 Jul 2003 21:28:27 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 82092 invoked by uid 500); 20 Jul 2003 21:28:27 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 82088 invoked from network); 20 Jul 2003 21:28:27 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 20 Jul 2003 21:28:27 -0000 Received: (qmail 21777 invoked by uid 1544); 20 Jul 2003 21:28:26 -0000 Date: 20 Jul 2003 21:28:26 -0000 Message-ID: <20030720212826.21776.qmail@icarus.apache.org> From: coliver@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom FOM_JavaScriptInterpreter.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N coliver 2003/07/20 14:28:26 Modified: src/java/org/apache/cocoon/components/flow/javascript/fom FOM_JavaScriptInterpreter.java Log: Fixed getSessionScope() to not automatically create a session Revision Changes Path 1.5 +11 -10 cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java Index: FOM_JavaScriptInterpreter.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- FOM_JavaScriptInterpreter.java 19 Jul 2003 20:16:27 -0000 1.4 +++ FOM_JavaScriptInterpreter.java 20 Jul 2003 21:28:26 -0000 1.5 @@ -265,12 +265,14 @@ throws Exception { Map objectModel = environment.getObjectModel(); Request request = ObjectModelHelper.getRequest(objectModel); - Session session = request.getSession(true); Scriptable scope = null; - HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE); - if (userScopes != null) { - String uriPrefix = environment.getURIPrefix(); - scope = (Scriptable)userScopes.get(uriPrefix); + Session session = request.getSession(false); + if (session != null) { + HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE); + if (userScopes != null) { + String uriPrefix = environment.getURIPrefix(); + scope = (Scriptable)userScopes.get(uriPrefix); + } } if (scope == null) { scope = createThreadScope(); @@ -305,7 +307,6 @@ session.setAttribute(USER_GLOBAL_SCOPE, userScopes); } String uriPrefix = environment.getURIPrefix(); - System.out.println("Session: setting :" + uriPrefix + ": " + System.identityHashCode(scope)); userScopes.put(uriPrefix, scope); return scope; } @@ -409,7 +410,7 @@ // Check if we need to compile and/or execute scripts synchronized (compiledScripts) { List execList = new ArrayList(); - boolean needsRefresh = lastExecTime == 0; + boolean needsRefresh = false; if (reloadScripts) { long now = System.currentTimeMillis(); if (now >= lastTimeCheck + checkTime) { @@ -423,7 +424,7 @@ // then create a list of scripts to compile/execute if (lastExecTime == 0 || needsRefresh || needResolve.size() > 0) { topLevelScripts.addAll(needResolve); - if (!needsRefresh) { + if (lastExecTime != 0 && !needsRefresh) { execList.addAll(needResolve); } else { execList.addAll(topLevelScripts); @@ -548,7 +549,7 @@ cocoon.setParameters(parameters); Object fun = ScriptableObject.getProperty(thrScope, funName); if (fun == Scriptable.NOT_FOUND) { - fun = funName; // this will produce a better error message + throw new ResourceNotFoundException("Function \"javascript:"+funName+ "()\" not found"); } ScriptRuntime.call(context, fun, thrScope, funArgs, thrScope);