cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
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)
Date Wed, 21 Apr 2004 13:34:33 GMT
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.

Admittedly, this is just a convenience for the developer.

	Ugo


Mime
View raw message