You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsoftware.com> on 2005/10/04 22:34:59 UTC

[lang] ArrayUtils.toPrimitive and NPEs.

Hello:

WRT: http://issues.apache.org/bugzilla/show_bug.cgi?id=36915

All of the ArrayUtils.toPrimitive one arg methods all NPE when an input
element is null. Why would you want that? 

We have a handy two arg version of the methods that allows a default
value to be passed in. Since primitives *have* default values, why not
simply allow nulls not to NPE and take on the default primitive value?
Seems easy enough to change...

Gary

Gary Gregory
Senior Software Engineer
Seagull Software
Web:	http://www.seagullsoftware.com
Email:	ggregory@seagullsw.com
Land:	310-546-3134
Mobile:	310-403-8747
Skype:	garygregory
Time Z:	USA, Pacific


Re: [lang] ArrayUtils.toPrimitive and NPEs.

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Gary Gregory wrote:
> Hello:
> 
> WRT: http://issues.apache.org/bugzilla/show_bug.cgi?id=36915
> 
> All of the ArrayUtils.toPrimitive one arg methods all NPE when an input
> element is null. Why would you want that? 
> 
> We have a handy two arg version of the methods that allows a default
> value to be passed in. Since primitives *have* default values, why not
> simply allow nulls not to NPE and take on the default primitive value?
> Seems easy enough to change...

But it would have compatability issues. At the very least its a semantic 
change.

I think that the basic reasoning is/was to have a validating version and 
a non-validating version of the same method.

So I guess I'm -0.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org