Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 86898 invoked from network); 14 Apr 2004 08:18:04 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 14 Apr 2004 08:18:04 -0000 Received: (qmail 29922 invoked by uid 500); 14 Apr 2004 08:17:35 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 29865 invoked by uid 500); 14 Apr 2004 08:17:34 -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 Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 29848 invoked from network); 14 Apr 2004 08:17:34 -0000 Received: from unknown (HELO vern.chem.tu-berlin.de) (130.149.66.116) by daedalus.apache.org with SMTP; 14 Apr 2004 08:17:34 -0000 Received: from verndeb.chem.tu-berlin.de (verndeb.chem.tu-berlin.de [192.168.66.131]) by vern.chem.tu-berlin.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id i3E8Hjgg015879 for ; Wed, 14 Apr 2004 10:17:45 +0200 Subject: Re: [RT] Checked exceptions considered harmful From: Stephan Michels To: Cocoon Developers In-Reply-To: <5336F609-8D84-11D8-83F3-000A95DC4186@apache.org> References: <5336F609-8D84-11D8-83F3-000A95DC4186@apache.org> Content-Type: text/plain Message-Id: <1081930694.2878.29.camel@verndeb> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 14 Apr 2004 10:18:14 +0200 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Am Di, den 13.04.2004 schrieb Ugo Cei um 21:54: > So, I'd like to make a proposal: > > - use unchecked exceptions *by default* unless there's a good reason > otherwise, not just because that's the way it's always been done. > > - wrap exceptions thrown by 3rd party packages (e.g. > org.xml.sax.SAXException) with Cocoon-specific, unchecked exceptions > (basicallly, abstain from throwing checked exceptions belonging to a > package different from the method's one, as this creates an unnecessary > dependence). > > - write tests to verify that methods don't throw exceptions for valid > inputs and that they throw appropriate exceptions (e.g. > InvalidArgumentException) for invalid ones. > > - document with a throws clause any unchecked exception that you > explicitly throw in a method, even if it's not required to do so. > Document it in the javadoc comment too. > > - for the next release (2.1.5), reparent all exceptions now extending > CascadingException, to extend CascadingRuntimeException instead and > remove all the code that does nothing more than rethrow them. > > - do the same for the Source package. > > Now just give me time to don my asbesto suite before firing ;-) Interesting approach! I see the benefits, if you compare it to flowscript, where you mostly don't care about exception handling. And if you want to, you can explicit catch the RuntimeExceptions. +1 Stephan.