Return-Path: Delivered-To: apmail-beehive-dev-archive@www.apache.org Received: (qmail 891 invoked from network); 3 Feb 2006 22:41:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Feb 2006 22:41:29 -0000 Received: (qmail 58836 invoked by uid 500); 3 Feb 2006 22:41:28 -0000 Delivered-To: apmail-beehive-dev-archive@beehive.apache.org Received: (qmail 58821 invoked by uid 500); 3 Feb 2006 22:41:28 -0000 Mailing-List: contact dev-help@beehive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Developers" Delivered-To: mailing list dev@beehive.apache.org Received: (qmail 58810 invoked by uid 99); 3 Feb 2006 22:41:28 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2006 14:41:26 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 2F477CB for ; Fri, 3 Feb 2006 23:41:05 +0100 (CET) Message-ID: <996403999.1139006465191.JavaMail.jira@ajax.apache.org> Date: Fri, 3 Feb 2006 23:41:05 +0100 (CET) From: "Carlin Rogers (JIRA)" To: dev@beehive.apache.org Subject: [jira] Updated: (BEEHIVE-1059) ClassCastException when InternalUtils.addActionError() casts ActionMessages for the Global.ERROR_KEY attribute to a sub class, ActionErrors In-Reply-To: <452141441.1139004903586.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/BEEHIVE-1059?page=all ] Carlin Rogers updated BEEHIVE-1059: ----------------------------------- Attachment: j1059-repro.zip This zip file includes a simple test to repro this issue. It can also be used as a test for the future. > ClassCastException when InternalUtils.addActionError() casts ActionMessages for the Global.ERROR_KEY attribute to a sub class, ActionErrors > ------------------------------------------------------------------------------------------------------------------------------------------- > > Key: BEEHIVE-1059 > URL: http://issues.apache.org/jira/browse/BEEHIVE-1059 > Project: Beehive > Type: Bug > Components: NetUI > Versions: V1, v.next, 1.0.1 > Reporter: Carlin Rogers > Assignee: Carlin Rogers > Fix For: v.next > Attachments: j1059-repro.zip > > The implementaion of InternalUtils.addActionError() casts the org.apache.struts.action.ActionMessages for the Global.ERROR_KEY attribute to a sub class of org.apache.struts.action.ActionErrors. However, in all the other code paths where we set the attribute for Global.ERROR_KEY, we use the parent class, ActionMessages. > If a user implements @Jpf.ExceptionHandler method in a page flow and then calls FlowController.addActionError(), they will experience this ClassCastException. When an exception is thrown, the DefaultExceptionsHandler will set the attribute for Global.ERROR_KEY with a new instance ActionMessages that includes the ActionMessage with the exception message. Then it invokes the exception handler declared in the annotations of the page flow. When the FlowController.addActionError() is called, the internal code path will call InternalUtils.addActionError() and try to cast the ActionMessages to ActionErrors, giving a stack trace like this... > 03 Feb 2006 14:55:19,987 ERROR DefaultExceptionsHandler []: Unhandled Page Flow Exception > Throwable: java.lang.ClassCastException: org.apache.struts.action.ActionMessages > Stack Trace: > java.lang.ClassCastException: org.apache.struts.action.ActionMessages > at org.apache.beehive.netui.pageflow.internal.InternalUtils.addActionError(InternalUtils.java:415) > at org.apache.beehive.netui.pageflow.FlowController.addActionError(FlowController.java:1439) > ... > I will add a test to this shortly. To reproduce you really just need an implementation of an exception handler that calls addActionError(). Something like this... > @Jpf.ExceptionHandler( > forwards = { > @Jpf.Forward( > name = "handleError", > path = "index.jsp") > }) > protected Forward bogusExceptionHandler( Controller.BogusException ex, > String actionName, > String message, Object form ) { > Object[] args = ex.getMessageArgs(); > addActionError("name", "messageKey_2", args); > return new Forward( "handleError" ); > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira