commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: [commons]NPE or IAE?
Date Wed, 21 Aug 2002 22:17:51 GMT
I think it is certainly true that NPE would more often than not indicate
a coding bug. I'm less convinced the same is true as often for IAE. I
can imagine trapping for IAE explicitly to handle the condition cleanly
but not for NPE since it theorically shouldn't happen in a running app
and can't be as easily handled.  In that case they really are two
separate conditions.

Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: ola.berg@arkitema.se [mailto:ola.berg@arkitema.se] 
> Sent: Wednesday, August 21, 2002 5:02 PM
> To: commons-dev@jakarta.apache.org
> Subject: RE: [commons]NPE or IAE?
> 
> 
> >Those callers who believe they are separate conditions can 
> handle them 
> >separately.
> 
> True. But since they are runtime exceptions, they can be 
> avoided by the caller anyway. One can argue that if they ever 
> occur, it is a bug in their programs, so they should not have 
> any automatic handling of the condition anyway. They should 
> read the message: \"This is illegal, it shouldn\'t be 
> null.\", and do any assertions on their part.
> 
> >Those who believe they are the same can handle them the
> >same.
> 
> How do they handle them the same?
> 
> BTW, PredicateUtils uses IAE even for nulls.
> 
> /O
> 
> --------------------
> ola.berg@arkitema.se
> 0733 - 99 99 17
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 
> 



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


Mime
View raw message