Return-Path: Delivered-To: apmail-beehive-user-archive@www.apache.org Received: (qmail 87113 invoked from network); 9 Oct 2007 19:01:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2007 19:01:22 -0000 Received: (qmail 77422 invoked by uid 500); 9 Oct 2007 19:01:10 -0000 Delivered-To: apmail-beehive-user-archive@beehive.apache.org Received: (qmail 77125 invoked by uid 500); 9 Oct 2007 19:01:09 -0000 Mailing-List: contact user-help@beehive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Users" Delivered-To: mailing list user@beehive.apache.org Received: (qmail 77114 invoked by uid 99); 9 Oct 2007 19:01:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 12:01:09 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of chad.schoettger@gmail.com designates 209.85.146.176 as permitted sender) Received: from [209.85.146.176] (HELO wa-out-1112.google.com) (209.85.146.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 19:01:10 +0000 Received: by wa-out-1112.google.com with SMTP id m28so2261282wag for ; Tue, 09 Oct 2007 12:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=/auwzwIGqRZCokzkDfy0PnN44s5WujUVCs4YV+X1oKc=; b=mSRYZA1F0Zz5Ngmb0UKkpaFoQWRuYyGHyO9wbXRO+uVHXxAb3Z5fcmMcaZaczNUFKUjmBd8wAppAH+Bpjr07NoHSGVpRyHix2dEigQ5+fmHC2RcKZFVSbpbj1Z1pvEeDwBIC9VLJdfhG4h0RL7Z8S7wWBHPvvKxF5NaED2K09Ds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tOAw5ElHLZnJSBAaH4HAZugrdlhJ3rQ6hkK80obGX1Gooc0oyN3N8guqbNCjVkr4bstc+CHmNsuYQ2P+bvWdgk2E+hxB9SR5rAnMwC9coc3lQFb5o/yJBZqrJB3qYF82fPMThFSktyja1HFinJeO0Nmxfe7RduiIYKccKnzFp+8= Received: by 10.115.90.1 with SMTP id s1mr7673404wal.1191956448835; Tue, 09 Oct 2007 12:00:48 -0700 (PDT) Received: by 10.114.158.6 with HTTP; Tue, 9 Oct 2007 12:00:48 -0700 (PDT) Message-ID: Date: Tue, 9 Oct 2007 13:00:48 -0600 From: "Chad Schoettger" To: "Beehive Users" Subject: Re: Throwing exception in event handler In-Reply-To: <20071006112513.XZ5KU.137680.root@eastrmwml08.mgt.cox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20071006112513.XZ5KU.137680.root@eastrmwml08.mgt.cox.net> X-Virus-Checked: Checked by ClamAV on apache.org Hello, I don't believe its possible to change the signature of onAcquire/onRelease event handlers since they are part of the core controls package. I think the documentation you mentioned was referring to custom event handlers defined by a user. What we have done in the past when it was desirable to throw an exception from one of these methods has been to wrap the exception in a org.apache.beehive.controls.api.ControlException which is a runtime exception and can be thrown from anywhere. - Chad On 10/6/07, ohaya@cox.net wrote: > Hi, > > I am working in a WebLogic/Workshop environment, and am VERY new to Beehive. > > I'm currently upgrading an application that was originally written in Workshop > 8.1 to WebLogic/Workshop 9.2. This application uses several custom controls, > and after upgrading by Workshop (via an import), the original custom controls > got "converted" to Beehive controls. > > The original custom controls used what use to be the context_onAcquire() and > context_onRelease() methods to setup the environment for the control code, and > to cleanup the environment, respectively, and after the initial conversion, > these two methods weren't being called. > > So, I manually added the necessary "things", e.g.: > > import org.apache.beehive.controls.api.events.EventHandler; > import org.apache.beehive.controls.api.context.ResourceContext; > . > . > @org.apache.beehive.controls.api.context.Context > ResourceContext resourceContext; > . > . > @EventHandler(field="resourceContext", > eventSet=ResourceContext.ResourceEvents.class, > eventName="onAcquire") > public void onAcquire() throws Exception > { > .. code that use to be in context_onAcquire() > } > > > @EventHandler(field="resourceContext", > eventSet=ResourceContext.ResourceEvents.class, > eventName="onRelease") > public void onRelease() throws Exception > { > .. code that use to be in context_onRelease() > } > > However, when I did that, and tried to build the application, I got an > "Unhandled exception type Exception" in a module named > "XXXImplInitializer.java": > > public void onAcquire() > { > __bc_impl.onAcquire(); > } > > [In the original non-Beehive code, context_onAcquire() had: > > public void context_onAcquire() throws Exception > ] > > I eventually worked around this problem by removing the "throws Exception" from > the "public void onAcquire()" and by commenting out all of the "throw new > Exception(...)" lines in the onAcquire() method. > > I think that info on the following page speaks to this under "Upgrading > Exception Handling in Control Event Handlers": > > http://edocs.bea.com/workshop/docs92/ws_platform/upgrading/conUpgradingJavaContr > ols.html > > As I mentioned, I am really new to Beehive, but I think that my "workaround" is > doing the 2nd option that page mentions, i.e.: > > "Remove the throws clause from the event handler code and implement another way > to handle exceptions generated from the event" > > But, I'd like to reinstate things so that my controls do throw exceptions, but > I'm not quite sure I understand how to implement the 1st option: > > "Add the throws clause your event handler is throwing to the EventSet event > method. You will also need to add a corresponding try/catch block to code that > invokes the event method" > > Is this just a matter of adding something to the "eventSet" in the > "EventHandler" annotation, and also, if that is the case, can someone tell me > exactly what I need to add there? > > Or, if I need to do something additional, what else do I need to do? > > Thanks in advance, > Jim > > >