From dev-return-113593-apmail-commons-dev-archive=commons.apache.org@commons.apache.org Wed Apr 08 13:35:33 2009 Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 39804 invoked from network); 8 Apr 2009 13:35:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Apr 2009 13:35:33 -0000 Received: (qmail 2067 invoked by uid 500); 8 Apr 2009 13:35:32 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 1946 invoked by uid 500); 8 Apr 2009 13:35:32 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 1936 invoked by uid 99); 8 Apr 2009 13:35:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Apr 2009 13:35:31 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=MSGID_MULTIPLE_AT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andre.dantas.rocha@uol.com.br designates 200.221.4.192 as permitted sender) Received: from [200.221.4.192] (HELO smtp.uol.com.br) (200.221.4.192) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Apr 2009 13:35:23 +0000 Received: from localhost (localhost [127.0.0.1]) by socom1.uol.com.br (Postfix) with ESMTP id BF9122550 for ; Wed, 8 Apr 2009 10:35:01 -0300 (BRT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=uol.com.br; s=ubz; t=1239197701; bh=aLeadMk5upCiyalRzxIJgtrYFR7pt/+2ZP3Gx8/b5Dg=; h=From:To:References:In-Reply-To:Subject:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; b=mVbVXobVy17AzRB5CS+JUYlCB7ezKXTfYTkwFnxirS5A7uWw+/HL2NyK/10fk3kgy LngIONQM4+Lu3iMEk/8GEYqS1NuqSJ1zfHfy6A+BwLp4/wOpJ/JbHdOWywis/+5mZu eWifuyPBA+K81KQ+TmqiG2vRhHDldq4ts4o734dA= Received: from ANDRE (unknown [189.64.145.130]) by socom1.uol.com.br (Postfix) with ESMTP id 8F2F916DF for ; Wed, 8 Apr 2009 10:34:56 -0300 (BRT) DomainKey-Signature: a=rsa-sha1; s=ubzo; d=uol.com.br; c=nofws; q=dns; h=dkim-signature:from:to:references:in-reply-to:subject:date: message-id:mime-version:content-type: content-transfer-encoding:x-mailer:thread-index:content-language; b=SHsZrJTc5rOUN5HoH3/jPm81tw5leG8ChPzBgPXw0ZPz9TiW8hUKfP4rpgDy8NJ41 5BkmNIuJsE+RF2hjXtalw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=uol.com.br; s=ubz; t=1239197701; bh=aLeadMk5upCiyalRzxIJgtrYFR7pt/+2ZP3Gx8/b5Dg=; h=From:To:References:In-Reply-To:Subject:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; b=mVbVXobVy17AzRB5CS+JUYlCB7ezKXTfYTkwFnxirS5A7uWw+/HL2NyK/10fk3kgy LngIONQM4+Lu3iMEk/8GEYqS1NuqSJ1zfHfy6A+BwLp4/wOpJ/JbHdOWywis/+5mZu eWifuyPBA+K81KQ+TmqiG2vRhHDldq4ts4o734dA= From: "Andre Dantas Rocha" To: "'Commons Developers List'" References: <34629.6446201906$1239108030@news.gmane.org> <25aac9fc0904080321l210cbe98te93e6863528c658c@mail.gmail.com> <1506684945536433966@unknownmsgid> <25aac9fc0904080549p6b253cc7s404b475e9b73f03e@mail.gmail.com> In-Reply-To: Subject: RES: Possible incubation? Date: Wed, 8 Apr 2009 10:34:53 -0300 Message-ID: <002f01c9b84e$cf634880$6e29d980$@dantas.rocha@uol.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acm4SWmQUdBpG80JT8qDr80j4VwtjwAALOXAAAEfuJA= Content-Language: pt-br X-SIG5: 21a1cc77e5057f6d5f0bf7068e297ef1 X-Virus-Checked: Checked by ClamAV on apache.org Oops... Where you see: throw handleException(e) replace with: throw new RuntimeException(handleException(e)); Andre -----Mensagem original----- De: Andre Dantas Rocha [mailto:andre.dantas.rocha@uol.com.br]=20 Enviada em: quarta-feira, 8 de abril de 2009 10:18 Para: 'Commons Developers List' Assunto: RES: Possible incubation? Hi Jorg, I understand your point, and maybe the framework need some improvement. Today it's only an initial code (any help and ideas are welcome). In my opinion handleException() must handle the original exception and = all exceptions that occurs inside it, so the code ever stops in this method: // code in framework public Throwable handleException(Throwable t) { try { ... } catch (Exception e) { // appropriate handling here } finally { return t; } } // usage try { doSomethingRisky(); catch(Exception e){ handleException(e); } If you want to propagate the original exception, you can do this: try { doSomethingRisky(); catch(Exception e){ throw handleException(e); } Maybe we can add a new parameter in handleException() specifying if the inside exception must be propagated. What do you think? Any new idea is valuable to solve the problem, if you have one please share... And... thanks for showing this kind of problem. Regards, Andre -----Mensagem original----- De: sebb [mailto:sebbaz@gmail.com]=20 Enviada em: quarta-feira, 8 de abril de 2009 09:49 Para: Commons Developers List Assunto: Re: Possible incubation? On 08/04/2009, Andre Dantas Rocha wrote: > Jorg, > > I don't agree with this point at all: "having a method call in a = catch block > > is > likely to cause problems for code analysis tools - as well as humans = - > as one cannot immediately tell if the code continues or not" > > > I believe it is possible to know if the code continues or not, for example, > if you rethrow the exception at the end of handle() method. Reading = your > message, however, I realized that it is a good idea to make handle() method > works more safely allowing it to throw original exception in case of error > inside it. So does the following code continue or not? try { doSomethingRisky(); catch(Exception e){ handleException(e); } And how can you be sure? > Andre > > -----Mensagem original----- > De: sebb [mailto:sebbaz@gmail.com] > Enviada em: quarta-feira, 8 de abril de 2009 07:21 > > Para: Commons Developers List > Assunto: Re: Possible incubation? > > > On 08/04/2009, J=F6rg Schaible wrote: > > Hi Andre, > > > > Andre Dantas Rocha wrote at Dienstag, 7. April 2009 14:38: > > > > > > > Hi all, > > > > > > This message was originally sent to incubator list, but they = suggest to > > > post it here because *maybe* the idea can fit in Commons = project. > > > > > > I'm developing a framework called Jeha. The main idea is to = provide > easy > > > exception description and handling using annotations in methods = and > > > classes > > > and some commons handlers. I believe that the idea is simple, = but > > > powerful. > > > > > > The initial code and start guide of framework are here: > > > > > > > > 931&release_id=3D650572> > > > > > > http://sourceforge.net/project/showfiles.php?group_id=3D242203&package_id= =3D2949 > > > 31&release_id=3D650572 > > > > > > I'd like to hear from community if this idea is valuable for a possible > > > incubation. > > > > > > Please let me know your opinion. > > > > > > It might be only me, but I see this approach a bit critical. On one hand > > you're right, writing exception code is quite tedious sometimes, = but with > > your solution you wipe out any useful method signature regarding > exception > > declaration. What happens if I don't wanna handle certain = exception types > > or RuntimeException instances? I cannot simply rethrow from the handler. > > I wondered about that. Also, having a method call in a catch block is > likely to cause problems for code analysis tools - as well as humans = - > as one cannot immediately tell if the code continues or not. > > Now, having a way to perform the same code for multiple exceptions > would sometimes be useful. Dunno whether that could be implemented. > > > - J=F6rg > > > > > > = --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > > For additional commands, e-mail: dev-help@commons.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org