Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 81603 invoked from network); 21 Apr 2004 18:12:58 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Apr 2004 18:12:58 -0000 Received: (qmail 50497 invoked by uid 500); 21 Apr 2004 18:12:45 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 50438 invoked by uid 500); 21 Apr 2004 18:12:45 -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 50415 invoked from network); 21 Apr 2004 18:12:44 -0000 Received: from unknown (HELO mail.gmx.net) (213.165.64.20) by daedalus.apache.org with SMTP; 21 Apr 2004 18:12:44 -0000 Received: (qmail 10893 invoked by uid 65534); 21 Apr 2004 18:12:48 -0000 Received: from a183069.studnetz.uni-leipzig.de (EHLO gmx.de) (139.18.183.69) by mail.gmx.net (mp016) with SMTP; 21 Apr 2004 20:12:48 +0200 X-Authenticated: #3483660 Message-ID: <4086B99E.9090702@gmx.de> Date: Wed, 21 Apr 2004 20:12:46 +0200 From: Joerg Heinicke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: de-de, de, en-us, en-gb, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: [cforms] refactoring questions (was Re: cvs commit: cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel Struct.java Messages.java Repeater.java MultiValueField.java AbstractContainerWidget.java Output.java Upload.java Action.java Form.java ContainerDelegate.java AbstractWidget.java Field.java Union.java BooleanField.java Widget.java) References: <20040420221928.11898.qmail@minotaur.apache.org> <4085A446.5050103@outerthought.org> <40862C3D.10002@cbim.it> <4086767D.8030602@outerthought.org> <40867869.2060205@cbim.it> <4086B76B.4000402@outerthought.org> In-Reply-To: <4086B76B.4000402@outerthought.org> Content-Type: text/plain; charset=us-ascii; format=flowed 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 On 21.04.2004 20:03, Marc Portier wrote: >>> yeah, but this is something that never needs to be catched it really >>> is a programming error, so I find the test for null unesessary and >>> the possible resulting NPE as more then RTE enough to commincate the >>> coding error. >> >> The problem with the NPE is that you'd need to look at the stacktrace >> to find what the exception is about, as you get no meaningful message, >> and the exception might be thrown when you try to dereference the null >> pointer, which could be far from where getId() is called. What I >> propose is to throw a RTE when the widget is built. Fail early, if you >> can. > > yep that is the idea completely > id should become a final member of the definition > as such it needs to be provided during build > > it could still be set to null, but would result in a state 'abstract' of > the definition meaning it is an a state that will make the > createInstance() on it to throw a RTE (IllegalState IMO) > (see wiki page WoodyRefactoring) > > this will result in instances that can only point back to definitions > that have an id set != null > > so getId() on instance level will effectively lead to always returning a > non-null > > unless we have made a programming error in setting up this chain, this > is not a circumstance IMO that requires additional RT checking to > generate specific RTE's +1 sounds ok. Joerg