Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 54143 invoked from network); 7 Feb 2007 13:54:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2007 13:54:28 -0000 Received: (qmail 93290 invoked by uid 500); 7 Feb 2007 13:54:33 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 93228 invoked by uid 500); 7 Feb 2007 13:54:33 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 93217 invoked by uid 99); 7 Feb 2007 13:54:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Feb 2007 05:54:33 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Feb 2007 05:54:25 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 89E547142B6 for ; Wed, 7 Feb 2007 05:54:05 -0800 (PST) Message-ID: <5854670.1170856445546.JavaMail.jira@brutus> Date: Wed, 7 Feb 2007 05:54:05 -0800 (PST) From: "Rob Berens (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Created: (COCOON-2006) ClassCastException in Rhino when creating a continuation in a catch block MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org ClassCastException in Rhino when creating a continuation in a catch block ------------------------------------------------------------------------- Key: COCOON-2006 URL: https://issues.apache.org/jira/browse/COCOON-2006 Project: Cocoon Issue Type: Bug Components: - Flowscript Affects Versions: 2.1.10 Reporter: Rob Berens In our example we use a dialog from within a catch block in javascript e.g. to ask for confirmation if a file already exists. It looks like this: try { write file catch (ex if ex.javaexception instanceof MyFileAlreadyExistsException) { if (overwriteDialog("Overwrite")) { overwrite file } } function overwriteDialog(message) { var form = new Form("path/to/dialog.fd"); var formWidget = form.form; formWidget.lookupWidget("message").setValue(message); form.showForm("/flow/path/to/dialog.html"); return "ok".equals(form.submitId); } In the overwrite dialog a form is created and shown thereby effectively creating a continuation. Formerly when using 2.1.8 this worked fine. In 2.1.10 we get a ClassCastException with the stack shown below. When changing the code like this, there is no problem: var exists = false; try { write file catch (ex if ex.javaexception instanceof MyFileAlreadyExistsException) { exists = true; } if (exists && overwriteDialog("Overwrite")) { overwrite file } I did some investigation in Rhino and found out that the enterFrames as referred in org.mozilla.javascript.Interpreter at line 2407 contain a frame that has a scope of class NativeWith which in the end leads to the ClassCastException. Thread [PoolThread-3] (Suspended (exception java.lang.ClassCastException)) org.mozilla.javascript.ScriptRuntime.enterActivationFunction(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable) line: 2847 org.mozilla.javascript.Interpreter.enterFrame(org.mozilla.javascript.Context, org.mozilla.javascript.Interpreter$CallFrame, java.lang.Object[]) line: 3855 org.mozilla.javascript.Interpreter.interpretLoop(org.mozilla.javascript.Context, org.mozilla.javascript.Interpreter$CallFrame, java.lang.Object) line: 2408 org.mozilla.javascript.Interpreter.interpret(org.mozilla.javascript.InterpretedFunction, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 2251 org.mozilla.javascript.InterpretedFunction.call(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 161 org.mozilla.javascript.ContextFactory.doTopCall(org.mozilla.javascript.Callable, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 340 org.mozilla.javascript.ScriptRuntime.doTopCall(org.mozilla.javascript.Callable, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 2758 org.mozilla.javascript.InterpretedFunction.call(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 159 org.mozilla.javascript.Context.call(org.mozilla.javascript.ContextFactory, org.mozilla.javascript.Callable, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) line: 489 org.mozilla.javascript.ScriptableObject.callMethod(org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, java.lang.String, java.lang.Object[]) line: 1556 org.mozilla.javascript.ScriptableObject.callMethod(org.mozilla.javascript.Scriptable, java.lang.String, java.lang.Object[]) line: 1526 org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.handleContinuation(java.lang.String, java.util.List, org.apache.cocoon.environment.Redirector) line: 842 org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 124 org.apache.cocoon.components.treeprocessor.sitemap.SelectNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.SelectNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 103 org.apache.cocoon.components.treeprocessor.sitemap.MatchNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext, java.lang.String, java.util.Map) line: 47 org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 108 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 143 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 93 org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 235 org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(org.apache.cocoon.environment.Environment) line: 177 org.apache.cocoon.components.treeprocessor.TreeProcessor.process(org.apache.cocoon.environment.Environment) line: 253 org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 118 org.apache.cocoon.components.treeprocessor.sitemap.SelectNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.SelectNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 103 org.apache.cocoon.components.treeprocessor.sitemap.MatchNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext, java.lang.String, java.util.Map) line: 47 org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 108 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 143 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode(org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode).invokeNodes(org.apache.cocoon.components.treeprocessor.ProcessingNode[], org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 69 org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 93 org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(org.apache.cocoon.environment.Environment, org.apache.cocoon.components.treeprocessor.InvokeContext) line: 235 org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(org.apache.cocoon.environment.Environment) line: 177 org.apache.cocoon.components.treeprocessor.TreeProcessor.process(org.apache.cocoon.environment.Environment) line: 253 org.apache.cocoon.Cocoon.process(org.apache.cocoon.environment.Environment) line: 699 org.apache.cocoon.servlet.CocoonServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) line: 1154 org.apache.cocoon.servlet.CocoonServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 853 org.mortbay.jetty.servlet.ServletHolder.handle(javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 358 org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.mortbay.jetty.servlet.ServletHolder) line: 294 org.mortbay.jetty.servlet.WebApplicationHandler(org.mortbay.jetty.servlet.ServletHandler).handle(java.lang.String, java.lang.String, org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 567 org.mortbay.jetty.servlet.WebApplicationContext(org.mortbay.http.HttpContext).handle(java.lang.String, java.lang.String, org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 1807 org.mortbay.jetty.servlet.WebApplicationContext.handle(java.lang.String, java.lang.String, org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 525 org.mortbay.jetty.servlet.WebApplicationContext(org.mortbay.http.HttpContext).handle(org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 1757 org.mortbay.jetty.Server(org.mortbay.http.HttpServer).service(org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 879 org.mortbay.http.HttpConnection.service(org.mortbay.http.HttpRequest, org.mortbay.http.HttpResponse) line: 789 org.mortbay.http.HttpConnection.handleNext() line: 960 org.mortbay.http.HttpConnection.handle() line: 806 org.mortbay.http.SocketListener.handleConnection(java.net.Socket) line: 218 org.mortbay.http.SocketListener(org.mortbay.util.ThreadedServer).handle(java.lang.Object) line: 300 org.mortbay.util.ThreadPool$PoolThread.run() line: 511 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.