commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ola Berg <>
Subject [commons]NPE or IAE?
Date Wed, 21 Aug 2002 20:23:17 GMT
A quickie.

When contributing new code directly to Commons, would you like me to use IllegalArgumentException
for all illegal arguments to a method, or NullPointerException for the illegal nulls?

This question goes out to
1) all Commons, since this is fresh code in Commons
2) io, since the particular class is in io
3) lang, since it works closely with lang

Preferences, anybody?

Personally, I prefer IAE, since that leaves me with only one exception to throw for all illegal
arguments, regardless of cause. Putting the right value in a parameter is something you do
in order to maintain consistency, avoiding NPE and other runtime exceptions. IMO.

Second: there was a thread on coding conventions lately. I wonder if it would be a benefit
if questions like these (such as naming conventions: XxxUtils/Xxxs, when to use toXxx and
when to use asXxx etc) could be answered in a \"prefered style\" document: a non binding style
guide that reflects the most popular styles of the committers, or lists the acceptable styles
(sorted in order of preference maybe)?

IIRC, XxxUtils was favored over Xxxs by the majority, but was that documented (elsewhere than
in the mails)? In a document where the answer to the NPE/IAE question should go too?  


0733 - 99 99 17

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message