cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
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 18:47:27 GMT
On 21.04.2004 20:14, Marc Portier wrote:

>> NPE is really bad - not only here - for the two mentioned reasons. But 
>> if you insist on your NPE you can change Ugo's proposal to
>>
>> if (id == null) {
>>   throw new NPE("id must not be null");
>> }
>>
>> So we have NPE, which is RuntimeE, meaningful message and early 
>> failure :)
>>
> 
> Sorry guys, be honest: you can't expect every deref in Java to be 
> proceeded by this kind of test?
> 
> 
> I admit NPE's are bad, but they indicate programming errors
> this one will surely come up during development test (believe me: 
> getId() is not something that will happen only in rare cases, I think 
> every sweap through any widget lifecycle is bound to call it at least 
> twice IMO)

But you can not give the form developer a NPE IMO as it happened for the 
bindings:

widget = getWidget(nonExistingId);

widget.aFunction();

If this won't be the case for your proposal I'm ok with it.

Joerg

Mime
View raw message