From: Kevin A. B. <bu...@re...> - 1999-12-23 04:45:03
|
It isn't the point that they would catch an NPE vs IAE. It is that an NPE usually means that my application has a bug in some logic and I am letting a null reference go unchecked. An IAE is useful when you are checking the integrity constraints of method parameters. Both work obviously but an IAE is the *right* way to do this. If I saw your code throwing an NPE I would assume that I screwed up. If I see an IAE it is that I screwed up because I passed an incorrect value. One of the cool things IMO is that it specifies assert()ions like code as in C++ which... if you have ever used them... are very powerful. Kevin Slava Pestov wrote: > > Kevin, > > Is there any real difference anyway? It's not like the caller would try > to catch NPEs/IAEs. -- Kevin A. Burton Senior Software Engineer Kendara.com |